Permalink
Browse files

feat: datatable增加参数forceDel,可不考虑状态强制删除数据

  • Loading branch information...
LiuYueKai committed May 18, 2017
1 parent bb948b2 commit 2ee566f560c02842eaa7846a79d6fb86e73cbf07
Showing with 9 additions and 2 deletions.
  1. +8 −1 src/indexDataTable.js
  2. +1 −1 src/rowDelete.js
View
@@ -162,6 +162,12 @@
* @default false
*/
this.pageCache = options['pageCache'] === undefined ? DataTable.DEFAULTS.pageCache : options['pageCache'];
/**
* DataTable删除数据时是否强制删除,如果设置为true则不再考虑数据的状态,执行删除时则删除此条数据。如果设置为false则需要考虑数据的状态,如果状态为new则删除此条数据否则将状态修改为fdel
* @type {boolean}
* @default false
*/
this.forceDel = options['forceDel'] === undefined ? DataTable.DEFAULTS.pageCache : options['forceDel'];
// 存储所有row对象
this.rows = ko.observableArray([])
// 存储所有的选中行的index
@@ -246,7 +252,8 @@
pageIndex: 0,
totalPages: 0,
pageCache: false,
enable: true
enable: true,
forceDel: false
}
DataTable.META_DEFAULTS = {
View
@@ -44,7 +44,7 @@ const setRowsDelete = function(indices) {
var ros = this.rows();
for (var i = 0; i < indices.length; i++) {
var row = this.getRow(indices[i]);
if (row.status == Row.STATUS.NEW) {
if (row.status == Row.STATUS.NEW || this.forceDel) {
ros.splice(indices[i], 1);
} else {
row.setStatus(Row.STATUS.FALSE_DELETE);

0 comments on commit 2ee566f

Please sign in to comment.