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.