ext 取得改变前 和改变后的 值

   第一种:输入框 值变化

     Ext.getCmp('cashReimbursei').on("change", function(field, newValue, oldValue){ var delta = (Number(newValue) - Number(oldValue)).toFixed(2); $("transferAmounti").value =( Number($("transferAmounti").value) + Number(delta)).toFixed(2); });

第二种:选择框 值变化

 Ext.getCmp('billFlag').addListener('select',function(field,record,index) { if(String(record.data.value)!==String(field.startValue)){ var gridStore = awPlanMake.detailGrid.getStore(); if(gridStore.getCount()>0) { Ext.MessageBox.confirm('', '确定改变单据标志吗?<br>如果改变单据标志,所有烟叶等级的重量将全部变为相反数。<br>注意:蓝单录入正数,红单录入负数。', function(btn, text) { if(btn == 'yes'){ for(var i=0;i<gridStore.getCount();i++) { var record = gridStore.getAt(i); record.set('weight',Number(-record.get('weight'))); record.set('weightTemp',Number(-record.get('weightTemp'))); } }else { field.setValue(field.startValue); } } ); } } });

 第三种:选择框 值变化  取得变化前的 index

//计量单位添加值变事件 Ext.getCmp('unit').addListener("change",function(field,newValue,oldValue){ var oldIndex = field.getStore().find(field.valueField,oldValue); var oldConvRate = Number(field.getStore().getAt(oldIndex).get('convRate')); var newConvRate = Number(field.getStoreOtherField('convRate')); var gridStore = awPlanMake.detailGrid.getStore(); for(var i=0;i<gridStore.getCount();i++) { var record = gridStore.getAt(i); if(record.get('weightTemp')!='') { var oldWeightTemp = Number(record.get('weightTemp')); record.set('weightTemp',oldWeightTemp*oldConvRate/newConvRate); } } });

你可能感兴趣的:(ext 取得改变前 和改变后的 值)