How to hide (hide) and destroy (close) Ext. Window

Source: Internet
Author: User

During the development of the past two days, I encountered such a problem: the data is normal when the window is opened for the first time, but the actual amount of data opened for the second and later is still the data opened for the first time.

After searching, it is found that the closing method of the window call is hide rather than close, that is, the closing method is essentially not closed, but the window is hidden. At this time, you only need to close the closing method, configure closeaction: 'close' in this way.

However, the problem occurs again, and the window cannot be opened once.

Code:

// Close this. buttonclose = new Ext. button ({text: 'close', ID: 'buttonclose', width: 200}); // Add this button. buttonnewadd = new Ext. button ({text: 'add access record ', ID: 'buttonnewadd', width: 200 }); // ****** the new window operation must be placed in the show method; otherwise, the close operation will fail to be opened for the second time. ***** this. win = new Ext. window ({ID: 'checkinfowin', layout: 'fit ', width: 800, height: 500, modal: True, draggable: True, resizable: false, closeaction: 'close', // close hide to hide animel: 'btnadd', title: "viewing customer visit information", buttons: [this. buttonnewadd, this. buttonclose], items: This. showtabpanel}); this. show = function (ID, name) {This. win. show ();} This. closewin = function () {This. parentform. store. reload (); this. win. close ();}

Modified:

This. show = function (ID, name) {// close the button this. buttonclose = new Ext. button ({text: 'close', ID: 'buttonclose', width: 200}); // Add this button. buttonnewadd = new Ext. button ({text: 'add access record ', ID: 'buttonnewadd', width: 200}); this. win = new Ext. window ({ID: 'checkinfowin', layout: 'fit ', width: 800, height: 500, modal: True, draggable: True, resizable: false, closeaction: 'close', // close hide to hide animel: 'btnadd', title: "viewing customer visit information", buttons: [this. buttonnewadd, this. buttonclose], items: This. showtabpanel}); this. win. show ();} This. closewin = function () {This. parentform. store. reload (); this. win. close ();}

In this way, the modification can be enabled normally.

PS: Pay attention to the Code in red and the position of each code segment.

I think the reason for this situation is: before the change, each component object is instantiated only once. When the window is closed and then opened, it cannot be adjusted to this component, so that the window cannot be displayed.

After the component is placed in the show method, the component will be instantiated once every time the show method is called, so it can be displayed normally.

   
   
   

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.