Permalink
Browse files

fix: 解决tree通过datatable删除数据时报错的问题

  • Loading branch information...
LiuYueKai committed Apr 7, 2017
1 parent 860f4c1 commit 12c290082a9da3cb0acc8325d08085a8516ae74e
Showing with 7 additions and 12 deletions.
  1. +7 −12 src/keroa-tree.js
View
@@ -344,18 +344,13 @@ var TreeAdapter = u.BaseAdapter.extend({
this.dataTable.on(DataTable.ON_DELETE, function(event) {
/*index转化为grid的index*/
- var gridIndexs = new Array();
- if (this.deleteRows.length > 0) {
-
- for (var i = 0; i < this.deleteRows.length; i++) {
- var row = this.deleteRows[i];
- var dataObj = row.data;
- var idValue = dataObj[oThis.options.idField].value;
- var node = oThis.tree.getNodeByParam('id', idValue);
- oThis.tree.removeNode(node)
- }
-
- }
+ $.each(event.rowIds, function() {
+ var rowid = this;
+ var row = oThis.dataTable.getRowByRowId(rowid);
+ var idValue = row.getValue(oThis.options.idField);
+ var node = oThis.tree.getNodeByParam('id', idValue);
+ oThis.tree.removeNode(node)
+ });
});
this.dataTable.on(DataTable.ON_DELETE_ALL, function(event) {

0 comments on commit 12c2900

Please sign in to comment.