m4eclipse
9 Oct 2010, 1:58 AM
In my application I want to make several GridPanel, and then put them to a TabPanel,however
Someone told me that if too many GridPanels are displayed in on web page, it will cause a Performance problem,the response of the page maybe go to slow.
So I tried to use just one GridPanel instance:
var store1=new Ext.data.JsonStore(.....);
var colM1=new Ext.grid.columnModel(....);
var store2=new Ext.data.JsonStore(.....);
var colM2=new Ext.grid.columnModel(....);
var commonGridPanel=new Ext.grid.GridPanel({store:store1,cl:colM1,viewConfig: {forceFit: true}});
var tabs2 = new Ext.TabPanel({
renderTo: document.body,
activeTab: 0,
plain:true,
defaults:{autoScroll: true},
items:[{
id:1,
title: 'Tab01',
listeners: {activate: handleActivate}
},{
id:2,
title: 'Tab02',
listeners: {activate: handleActivate}
},
//Here I have tried this:items[commonGridPanel,commonGridPanel,commonGridPanel],but it doesnot work.
]
});
function handleActivate(tab){
tab.removeAll();
var id=tab.getid();
if(id==1){
commonGridPanel.reconfigure(store1,colM1);
} else if(id==2){
commonGridPanel.reconfigure(store2,colM2);
}
tab.add(commonGridPanel);
tab.doLayout();
}
So I wonder if this is a good manner?
Also I meet some problems when using this manner:
1)From the api I know "certain existing settings may become invalidated",so the view config:forceFit=true does not work when the first time I open the page.
That's to say how to reset the gridveiw after call the reconfigure method of the GridPanel?
2)When I click the tabs of the TabPanel,my page will scrolled to top automaticly,since I found that the link of the tab title is "http://host:port/path/#",so I wonder if this is the reason?
3)The size of the GridPanel and its parent---the TabPanel.
Right now, I set them with the same size,however what's going on is that there are two scroll bars at the sametime,one for the gridPanel, and one for the TabPanel,
so is there a good manner to set the size of each? I just want the gridpanel fit for the TabPanel.
I tried to set the "autoheight=true" for the gridPanel, if so,problem 2 will occur.
Any ideas ,guys?
Someone told me that if too many GridPanels are displayed in on web page, it will cause a Performance problem,the response of the page maybe go to slow.
So I tried to use just one GridPanel instance:
var store1=new Ext.data.JsonStore(.....);
var colM1=new Ext.grid.columnModel(....);
var store2=new Ext.data.JsonStore(.....);
var colM2=new Ext.grid.columnModel(....);
var commonGridPanel=new Ext.grid.GridPanel({store:store1,cl:colM1,viewConfig: {forceFit: true}});
var tabs2 = new Ext.TabPanel({
renderTo: document.body,
activeTab: 0,
plain:true,
defaults:{autoScroll: true},
items:[{
id:1,
title: 'Tab01',
listeners: {activate: handleActivate}
},{
id:2,
title: 'Tab02',
listeners: {activate: handleActivate}
},
//Here I have tried this:items[commonGridPanel,commonGridPanel,commonGridPanel],but it doesnot work.
]
});
function handleActivate(tab){
tab.removeAll();
var id=tab.getid();
if(id==1){
commonGridPanel.reconfigure(store1,colM1);
} else if(id==2){
commonGridPanel.reconfigure(store2,colM2);
}
tab.add(commonGridPanel);
tab.doLayout();
}
So I wonder if this is a good manner?
Also I meet some problems when using this manner:
1)From the api I know "certain existing settings may become invalidated",so the view config:forceFit=true does not work when the first time I open the page.
That's to say how to reset the gridveiw after call the reconfigure method of the GridPanel?
2)When I click the tabs of the TabPanel,my page will scrolled to top automaticly,since I found that the link of the tab title is "http://host:port/path/#",so I wonder if this is the reason?
3)The size of the GridPanel and its parent---the TabPanel.
Right now, I set them with the same size,however what's going on is that there are two scroll bars at the sametime,one for the gridPanel, and one for the TabPanel,
so is there a good manner to set the size of each? I just want the gridpanel fit for the TabPanel.
I tried to set the "autoheight=true" for the gridPanel, if so,problem 2 will occur.
Any ideas ,guys?