PDA

View Full Version : How can change the containing grids dynamically?



proofmoore
15 Dec 2010, 4:54 AM
Hi!

I have a gridpanel in a panel. I want to load different grids as the user interacts. Thanks.

arthurakay
15 Dec 2010, 6:09 AM
The API docs are your friend :-)
- http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel

Look at the add()/remove() methods on the Panel class. You'll also need to call doLayout() after you've added the new grid to your panel so that it can re-render itself.

Animal
15 Dec 2010, 6:20 AM
And remember. When you are saying do layout..... what layout?!

christian130
15 Dec 2010, 6:28 AM
if u wanna make a grid into a grid the solution is what arthur said to u. But if u wanna "reload" simply, call the store again if the store has not refreshed u can make a grid.getView().refresh().
u can browse in the api documentation also into the source code IT WILL NOT BITE!

proofmoore
16 Dec 2010, 1:53 AM
I call "doLayout" for the panel, but did not work. then tried for the Viewport(contains my all-panels)

But I dont see the grid which I try to add.

here what i do

getGrid(active,editable){

create a grid // ! I can see grid loads its store when call getGrid

Ext.getCmp('target_panel_id').items.add(grid);

Ext.getCmp('target_panel_id').doLayout();

}


note: I never post here without checking the documentation. I ask when I still dont know how to do it.

Animal
16 Dec 2010, 4:57 AM
why .items.add?

And what IS the layout of "target_panel_id" which you are asking to do its job?

proofmoore
16 Dec 2010, 9:09 AM
because I need different grids in a panel,as 'arthurakay' suggested .

add/remove did not work. although doLayout(); removed grid still appears and added grid doesnt show up. I checked if I really add/remove with the panel.items.lenght(number of items did change true).

anyway now I do it without removing grid. I create all grids and show/hide them as the user interacts. thanks for your answers.