I have a Ext.Window which is called inside a function. I pass a parameter to window
through function. When I try to re-open window
with a new value, window
performs operations with the old value.
Here is my code -
var Win;
LoadWindow = function (id) {
if (!Win) {
Win = new Ext.Window({
id: 'Pop-win',
layout: 'fit',
width: 650,
modal: true,
height: 450,
closeAction: 'close',
plain: true,
items: [Panel],
listeners: {
close: function (w) {
Win.removeAll();
},
show: function (p) {
Store.reload({
params: {
'ID': id
}
});
}
}
});
}
Win.show();
}
PS: I Use extjs 3.4 version
Move the Store.reload(); part out of the show listener. The id it refers to is always referring to the first time you create the window.
If this window is not being used too often, it might suffice to simply change it to use closeAction: 'destroy' so that you generate a new window each time. If you need to reuse it, write a helper function on the window that reloads the store separately, and call Win.customStoreReload() followed by Win.show(). By the way, closeAction: 'close' is also not a valid closeAction. The config can only be set to either 'destroy' or 'hide'.
LoadWindow = function (id) {
if (!Win) {
Win = new Ext.Window({
id: 'Pop-win',
layout: 'fit',
width: 650,
modal: true,
height: 450,
closeAction: 'hide', // either 'hide' or 'destroy'. 'close' is not a valid option
plain: true,
items: [Panel],
listeners: {
close: function (w) {
Win.removeAll();
}
}
});
}
Store.reload({params: { 'ID': id }});
Win.show();
}