PDA

View Full Version : How to hard refresh tab



ppt
1 Sep 2009, 2:33 AM
when I click another tab,I want to change items in there
I try to use method 'tabchange'.
when I click new tab I can get there tab from method 'tabchange'.
After that I remove old items and add new items, I use firebug for
see value in that tab ,I see new items(I just add).
So I try to refresh tab for show new items but I cannot do.

I try to use this command

tab.getUpdater().refresh()

but I get nothing.

How can I do
Please let me know
Thank you for reply.

ppt
2 Sep 2009, 12:26 AM
I can remove all item and add item in there,
but when I add object in tab and refresh tab(use doLayout),it's not work
Please check this code


var count=0;
Ext.onReady(function(){
Ext.QuickTips.init();
var firstItem = new Ext.Panel({
id: 'first-item',
region: 'north',
layout: 'absolute',
border: false,
height: 400,
frame: true,
items: [{
xtype: 'label',
x: 5,
y: 5,
html: 'name'
},{
xtype: 'label',
x: 105,
y: 5,
html: 'TestClick Tab'
}]
});
var secondItem = new Ext.Panel({
region: 'center',
html: ""
});
var mainTab = new Ext.TabPanel({
renderTo: Ext.getBody(),
activeTab: 1,
width: 1000,
height: 800,
items: [{
title: 'tab 1',
id: 'tab-1',
html: 'Test chang items when click!!'
},{
title: 'tab 2',
id: 'tab-2',
layout: 'border',
frame: true,
border: false,
items: [firstItem,secondItem]
}]

});
mainTab.on('tabchange',function(a,tab){
if(tab.id == 'tab-2')
{
console.log(tab);
tab.removeAll();

count++;

///////////////////
var itemChanged = new Ext.Panel({
region: 'north',
layout: 'absolute',
border: false,
height: 400,
frame: true,
items: [{
xtype: 'label',
x: 5,
y: 5,
html: 'This tab already changed!!'
},{
xtype: 'label',
x: 5,
y: 40,
html: String.format('<b>Count {0}</>',count)
}]
});

tab.add(itemChanged);
tab.add(secondItem);
tab.doLayout();

}
});



});


Can I add object in tab and refresh tab?
please tell me.
thank you for reply.