Permalink
Browse files

fix: grid增加onBeforeValueChange处理

  • Loading branch information...
1 parent 0a24811 commit be4fee3c0c01cb8177c8eaccdbc8e755b03d2bc6 liuyk committed Nov 29, 2016
Showing with 12 additions and 0 deletions.
  1. +12 −0 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') {

0 comments on commit be4fee3

Please sign in to comment.