我使用Backbone集合创建表并应用jquery数据表进行分页。我有一个图标来删除该行。单击时,它将从集合中删除,但删除的行仍存在于数据表中。
更多信息:
我收集了人员详细信息(名字:Tony)。此数据将位于模板“{{firstname}}”中。这样我就在模板中设置整行。假设我的集合被命名为“addedGridRowCollection”,每个人的详细信息都被设置为模型(例如:addvisModel),而模型则设置为集合。因此代码是---
var addedVisitorGridView = new AddedVisitorGridView({
collection: addedGridRowCollection
});
newVisitorLayoutView.gridRegion.show(addedVisitorGridView);
addedVisBasicModel.set("firstname", "Tony"); addedGridRowCollection.add(addedVisBasicModel);
applyDataTable(); // applying jquery data table
$(addedVisitorGridView.el).show();
Now in delete trigger: when I clicked on Delete button,The following is the code I am using:
var indx= model.get('index');
var visModel = addedGridRowCollection.findWhere({index: indx});
addedGridRowCollection.remove(visModel);
here it removes from collection but not from the data-table (Jquery).