backgrid.js delete selected

977 views Asked by At

I am trying to add a delete button to a datagrid (using backgrid.js http://backgridjs.com/)

I have a select row

var grid = new Backgrid.Grid({
  columns: [{

    // name is a required parameter, but you don't really want one on a select all column
    name: "id",

    // Backgrid.Extension.SelectRowCell lets you select individual rows
    cell: "select-row",

  }].concat(columns),
  collection: contacts
});

a button:

<button id= "button" type="button">Delete</button>

and:

$('#button').click(function () {

});

but how do i get the selected row id ? and send it to the server, to delete data from DB?

1

There are 1 answers

0
Y.H Wong On

There's an entry on the documentation describing Grid#getSelectedModels.