PDA

View Full Version : Ext.Window.show() keeps the old parameter value when re-opens the window



sande0005
26 Feb 2014, 7:53 AM
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();
}

wm003
28 Feb 2014, 3:38 AM
This is because the second time "Win" is already available so it's not getting rerendered again. the "id" parameter the second tim is out of scope then. You should try something like



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 (w) {
Store.reload({
params: {
'ID': w.myParamsID
}
});
}
}
});
}
Win.myParamsID = id;
Win.show();
}