0

i am have integrated backgrid.js with backbone.marionnette.js. there is spec in the document as how to delete a single row or column from grid as follows

// Remove a column
var genderCol = grid.columns.where({ name: "gender" });
grid.removeColumn(genderCol);

// Remove rows
var musketeers = grid.collection.where({ job: "Musketeer" });
grid.removeRow(musketeers);

but how to remove multiple rows from the grid as well as in the database using backgrid.js

Thanks and regards

Java Questions
  • 7,813
  • 41
  • 118
  • 176

2 Answers2

1

Call Backbone.Model#destroy() to remove and destroy a model from a collection. Backbone has no batch removal facility so you will have to remove them one by one.

Y.H Wong
  • 7,151
  • 3
  • 33
  • 35
0

it is as simple as collection.add or collection.remove

Refer for removing same is applicable for add.this

to get a collection of selected models from backgrid

var selectedModels = grid.getSelectedModels();

to remove

backgriCollections.remove(selectedModels);

Very simple.

Java Questions
  • 7,813
  • 41
  • 118
  • 176