Reset extjs form (conflict between adding and modifying values)
In common code, we use addform. Form. Reset (); or addform. getform (). Reset (); To reset formpanel.
However, when you add or modify a public formpanel on the page, When you click Modify first, the data is displayed after the form is modified. hide (), but when you click "add", you can operate it as you like. When you add it, you will find that the data is still displayed on the form. If you add a new one before viewing the changes, the side will always be a blank form.
Therefore, when you click Modify, first window. Show () and then load the data:
1 function updateform () {2 var Sm = grid. getselectionmodel (). getselected (); 3 // obtain the data 4 var sm_num = grid after the check box is selected. selmodel. getselections (). length; // Number of checked Items 5 If (! SM) {6 Ext. MSG. alert ("modify operations", "select items to modify"); 7} else if (sm_num> 1) {8 Ext. MSG. alert ("Modify operation", "You cannot select more than one modified record"); 9} else {10 win. show (); // first display Form 11 formpanel. form. loadrecord (SM); // reload data 12} 13}
In this way, the addition and modification will not conflict.
From: http://www.cnblogs.com/280850911/archive/2012/08/15/2640749.html