PDA

View Full Version : Changing config of Parent Panel



rebeccapeltz
30 Dec 2010, 10:50 AM
see http://www.sencha.com/forum/showthread.php?119205-Using-Tools-for-Help-popup for history of this development.

I'm trying to change the help text that is rendered via the 'help' tool, when a user clicks on a tab. I have a container panel (the parent) that contains a tab panel that holds 3 grid panels. The help is defined in the config of the parent panel. Using the 'activate' event listener of the gridpanel, I want to change the parent panel's config setting for the 'tools' config. I know that my listener is working and I know that I am able to get the correct parent panel. When I change the value of the config, it doesn't seem to change the text in the help popup. Is there some type of refresh I need to do. As you can see in the code below, I've tried the .getUpdater().refresh() and I've also tried calling a doLayout(), but neither seems to pick up the new help text.

Is is OK to change a panel's config values after it is rendered?

Here is the code in one of the gridPanel's 'activate' listener. Basically I am

getting the parent container
setting the parent container's tools property



'activate': {
fn: function(pnl,e){
var parentPanel = pnl.findParentByType('panel');
parentPanel.tools = [{
id: 'help',
collapsible: true,
qtip: "Click for help",
handler: function(event, toolEl, panel){
var helpTitle = 'Labs In Process';
var helpText = 'Labs in process help text';
var popup = new Ext.Window({
width: 400,
bodyCssClass: 'help-body',
closeAction: 'close',
title: helpTitle + ' Help',
autoScroll: true,
html: helpText
});
popup.render(Ext.getBody());
popup.alignTo(toolEl, 'tl-bl');
popup.show();
popup.el.on('click',function(){
popup.close();
});
}
}]

parentPanel.getUpdater().refresh();
}
}

slemmon
30 Dec 2010, 11:08 AM
Sounds like once it's rendered you'll need to update the content of the panel body with new content.
What about checking to see if it's rendered and if so, then do something like popup.body.update('NEW_CONTENT')?