From be4fee3c0c01cb8177c8eaccdbc8e755b03d2bc6 Mon Sep 17 00:00:00 2001 From: liuyk Date: Tue, 29 Nov 2016 15:37:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20grid=E5=A2=9E=E5=8A=A0onBeforeValueChang?= =?UTF-8?q?e=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/gridCompOperateRow.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/gridCompOperateRow.js b/js/gridCompOperateRow.js index 5f78b77..74ff7f1 100644 --- a/js/gridCompOperateRow.js +++ b/js/gridCompOperateRow.js @@ -384,6 +384,18 @@ const updateValueAt = function(rowIndex, field, value, force) { if (typeof value == 'undefined') value = ''; if (oldValue != value || force) { + if (typeof this.options.onBeforeValueChange == 'function') { + var obj = {}; + obj.gridObj = this; + //因为树表更新时候可能改变rowIndex的顺序 + obj.rowIndex = treeRowIndex; + obj.field = field; + obj.oldValue = oldValue; + obj.newValue = value; + var flag = this.options.onBeforeValueChange(obj); + if(!flag) + return; + } $(this.dataSourceObj.rows[rowIndex].value).attr(field, value); $(this.dataSourceObj.options.values[this.dataSourceObj.rows[rowIndex].valueIndex]).attr(field, value); if (this.showType == 'grid') {