Reset extjs form (conflict between adding and modifying values)

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.