PDA

View Full Version : Single content for multiple tabs



ironlion
4 Feb 2010, 4:02 PM
Hello ext lovers,

I have a big editor grid and multiple tabs. I am trying to use only one grid for each tabs while selecting tab changing the filter of grid store, without content duplication.

How to do it in good order?

Thanks for your advice.

tobiu
5 Feb 2010, 5:54 AM
if you want to use only one grid, why dont you take a toolbar above it and use each button to set a filter. this should at least be the thing you want to do.

otherwise you can create a grid in each tab (write a factory or extended class), but this will let the dom grow much bigger (advantage is, that you can switch back and forth and keep changes like sorting etc.).

kind regards,
tobiu

ironlion
5 Feb 2010, 2:23 PM
There are some reason to do it with tabbed layout. I'll try 2nd way you adviced.
Thank you, Tobiu

PCSpectra
5 Feb 2010, 5:45 PM
Can you not just replace the store associated with a grid at runtime according to selections?

A quick look at the docs shows there is no setStore() but there is a getStore(). However you might be able to dosomething like:

grid.store = new_store;

Cheers,
Alex

tobiu
6 Feb 2010, 1:24 AM
hi PCSpectra,

what you means is

reconfigure( Ext.data.Store store, Ext.grid.ColumnModel colModel ) : void
Reconfigures the grid to use a different Store and Column Model and fires the 'reconfigure' event. The View will be ...

Reconfigures the grid to use a different Store and Column Model and fires the 'reconfigure' event. The View will be bound to the new objects and refreshed.

Be aware that upon reconfiguring a GridPanel, certain existing settings may become invalidated. For example the configured autoExpandColumn may no longer exist in the new ColumnModel. Also, an existing PagingToolbar will still be bound to the old Store, and will need rebinding. Any plugins might also need reconfiguring with the new data.

but this is not the point here, since changing a filter works fine with 1 store.

kind regards,
tobiu