1 //datagrid 列数据 2 $('#acc').datagrid({ 3 columns : [ [ 4 { 5 field : 'fee_lend', 6 title : '收费A', 7 width : 100, 8 editor : "numberbox" 9 }, { 10 field : 'fee_loan', 11 title : '收费B', 12 width : 100, 13 editor : "numberbox" 14 }, 15 ] ] 16 }) 17 //编辑费用大于零则另一方赋值为空 18 onBeginEdit : function(rowIndex, rowData){ 19 var editors = $('#acc').datagrid('getEditors', rowIndex); 20 var lendEditor = editors[0]; 21 var loadEditor = editors[1]; 22 //target属性就用于返回最初触发事件的DOM元素 23 lendEditor.target.numberbox({ 24 onChange:function(newValue,oldValue){ 25 if(newValue > 0){ 26 loadEditor.target.numberbox('setValue', null); 27 } 28 } 29 }); 30 31 loadEditor.target.numberbox({ 32 onChange:function(newValue,oldValue){ 33 if(newValue > 0){ 34 lendEditor.target.numberbox('setValue', null); 35 } 36 } 37 }); 38 },