PDA

View Full Version : Grid Detach



anton_ds
18 Jan 2010, 3:33 AM
Hello forum.

I have a question.

I have 1 content panel, and alot of grids on it, but only 1 of them is attached.

For change grid i'm using this procedure:


private void switchGrid(GridView gridView) {
if (gwCurrent != null) {
cpForm.removeAll();
gwCurrent = null;
}
gwCurrent = gridView;
cpForm.add(gwCurrent);
cpForm.layout();
}


And it's work fine, except when I calling cpForm.removeAll(); grid currently Attached on this form, starts load data. how can I remove grid, without load data call??

terciofilho
18 Jan 2010, 3:50 AM
Why don't you use a CardLayout?

Or hide() and show() functions?

anton_ds
18 Jan 2010, 3:54 AM
Why don't you use a CardLayout?

Or hide() and show() functions?

I have alot of grid on this form. and if I'm trying to attach it all -- then forms open's realy slow.

And I never use CardLayout -- i'll try it now

terciofilho
18 Jan 2010, 3:56 AM
What do you mean by Form, a FormPanel?

terciofilho
18 Jan 2010, 3:57 AM
Anyways, CardLayout will take care of this issue for you, for sure. It will display only one component at a time, so no need to worry about rendering issues.

anton_ds
18 Jan 2010, 5:12 AM
What do you mean by Form, a FormPanel?
ContentPanel in fact. Just call a var as cpForm