我在提交編輯詳細信息表單之前正在進行髒檢。這是在表單加載後第一次工作,但如果我提交表單一次,髒檢查在隨後的調用中停止工作。ExtJS - 表格上的骯髒檢查僅在第一次運行
if(editForm.getForm().isDirty()) {
editForm.getForm().submit({
url:'app/update',
waitMsg:'Saving data',
success:function(form,action) {
Ext.Msg.alert("Success", "Successfully updated");
},
failure: function(form,action) {
Ext.Msg.alert("Failure", "Failed to update");
}
});
} else {
Ext.Msg.alert("Message", "Nothing has been changed since you last saved.");
}
我不認爲會有更快的方法來實現這一點。 'isDirty'是一種循環遍歷所有字段並查找髒字段的方法,因此如果修改了與首先加載的數據不同的任何位,它總是會返回「true」。 – 2011-04-19 06:56:57