PDA

View Full Version : Tab rendering problems :-(



laoshi
11 Sep 2008, 2:37 AM
Hello guys,

I have a few tabs and on them I have progress bars.
They show up fine, but I have a few on load fuctions for my stores which remove the bars and replace them with a label when the load is done.
On an active tab that is no problem, but when the loading for an inactive tab is completed the on load function correctly removes the progress bar and it seems that the label is added too, but just not rendered.

I'm sure I just forgot something to add, but how to force the label that replaces the bar to get rendered when the tab is inactive? :-(

My Tabpanel options are:
deferredRender:false,
resizeTabs:true,
monitorResize:true,
minTabWidth: 115,
tabWidth:145,
enableTabScroll:true,
autoHeight:true,
defaults: {autoScroll:true},
activeTab:0,
layoutOnTabChange: true,

evant
11 Sep 2008, 2:38 AM
Try adding layoutOnTabChange: true to your tab panel definition.

laoshi
11 Sep 2008, 3:17 AM
Thats in there:



layoutOnTabChange: true,

laoshi
11 Sep 2008, 3:18 AM
maybe i need to call some kind of render methods when I change stuff in not visible tabs?
Hmm

Animal
11 Sep 2008, 4:05 AM
Who knows? Not us, we have no idea what you are doing.

laoshi
11 Sep 2008, 4:50 AM
Who knows? Not us, we have no idea what you are doing.

Ok I'll try it again.
I want to know if I have to make some kind of a render call or something like that when I add/remove elements from a not visible tab, because it seems like I have to.

What I do is:


store.on('load', function(store,records,options) {
if (store.getCount() == 0) {
Ext.getCmp('nc-fieldset-'+options.params.kn).remove('nc-'+options.params.kn);
Ext.getCmp('nc-fieldset-'+ options.params.kn).add({
xtype: 'label',
text: 'Keine gefunden'
});
}
else {
Ext.getCmp('nc-fieldset-'+options.params.kn).remove('nc-'+options.params.kn);
Ext.getCmp('nc-fieldset-'+ options.params.kn).add({
xtype: 'button',
text: 'Tickets anzeigen',
id: 'nc-button-'+options.params.kn
});
}
});
Basically I just check in the load handler if I got data or not and then want to remove the progress bar and add a label or a button.

laoshi
11 Sep 2008, 4:59 AM
It works now! Finally!

I cleaned up the code down to just what I just posted and then the opposite happens.
The not displaying tab gets rendered when I activate it while the displayed tab doesnt and the label is not visible in the active tab.
I added a "renderTo" parameter to the label (rendering it to the formfield) and now it seems to work.

Still wonder if thats the best way to do it.

Animal
11 Sep 2008, 6:08 AM
No. do not render.

the problem is taht you have layoutOnTabChange:true which is good, it's taking care of showing the changes that you make to hidden tabs because it calls "doLayout()" on tab change.

But if you modify the currently showing tab you must call doLayout() on it as mentioned many thousands of times before.