View Full Version : [URGENT] Cannot apply states to reconfigurable grid!

24 Jul 2014, 3:57 AM
We've been trying to achieve this for some days now but it seems impossible.
Is there a way to create a Stateful grid (i.e. saving the state of the columns etc.) while at the same time loading the data with reconfigure: true?
Essentially what we have is a combobox that decides what columns the grid has.
We want the user to be able to customize the grid's appearance for each of those combobox choices. Whenever the combobox value changes we load the grid with reconfigure: true to bring differentcolumns in. However we have no idea how to save the state for those columns.
The state is saved in a database with a stateId that depends on the combobox choice so that we know which configuration we're looking at and what state to load depending on the combo choice. But from what we've come to understand, the state gets applied first, then the reconfigure so it always messes the state.
Anyone has any ideas about this?

EDIT: We found out some stuff about how all this process works but still no answer. We're gonna try to edit the core code of ExtJS but we'd prefer to find a different solution.

Right now when you create a stateful reconfigurable grid this is what happens:
1. The Grid gets created
2. The state gets applied (the one from the database)
3. The grid gets rendered but since it has no data/columns it has an 'empty' state
4. This state gets saved back (essentially ruining our original correct state)
5. The store gets loaded and the columns get added but there is a partial rendering (the grid itself doesn't get re-rendered).
6. The state now is the default one with the columns and it gets saved back to the database

Even manually applying a state does nothing since it doesn't get rendered. We've tried many 'rendering' options but nothing seems to work. Any ideas?

1 Aug 2014, 9:49 AM

Statefulness is designed to be employed internally by the component at instatiation / render time and isn't set up to be called at runtime.

You'll likely be best served destroying and re-building the grid altogether rather than using reconfigure in this instance.

*BTW, we don't recommend editing the ExtJS code directly. If you do decide to override the code it would be better to extend or override a class using Ext.define(). The API docs for define() talk more about this process.