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

15 Dec 2010, 4:54 AM

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

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.

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

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!

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


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




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

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?

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.