Your example isn't runnable - We can't be sure what BaseWidget is doing for setup, and Order, OrderProperties are missing.
The Basic Grid example at http://sencha.com/examples/#ExamplePlace:basicgrid uses state, and a column can be hidden in state. Specifying things that _aren't_ hidden hidden wasn't accounted for in the GridStateHandler - I'll file a bug so we can review this and how to make the change.
As a possibility for a workaround, consider setting each column _via the ColumnModel_ instead of on the ColumnConfig - do it after the state wiring has been set up. This will add that hidden column to the state object, and it will track it as a hidden column, as if it was hidden by the user. The next step then is to make sure that you only do this if there is no state available for that grid - if there is, don't bother setting it, as the state should take over. Easiest way there is to ask the state manager for the grid's state - if it comes back as the default instance (with no Set<String> for hidden columns) then it hasn't been set, go ahead and hide it.
We'll update this thread when we have a fix available in SVN.
Thanks for the reply and the workaround. I will make sure going forward I include the Model and the properties as well. The idea behind the example was to show it is a very basic GXT grid, with a default hidden field, which would cause this issue. Also this was working with 2.X without the GridStateHandler.
I just tried the workaround suggested. Below is the modified piece of code.
GridStateHandler<Order> state =
//if the state does not exist, hide columns with defaults
if(state.getState()==null || state.getState().getHidden()==null)
Please let me know if the above code looks correct.
The problem I still find with the above workaround is , when I unhide one of the above hidden field, the state has the hidden Set<String> created with no column name. So both of the hidden fields show up after refresh. Everything after these have showed up works fine. We have an existing PROD application which has around 60+ fields and on the initial load only has 20 fields which are visible. the users choose to customize their own views. After our upgrade to 3.0 , this functionality seems to be broken & would appreciate any help with it.
I got this to work with manually setting the default hidden fields to the state. I do this only when the hidden Set<String> is empty. Below is the code.
final GridStateHandler<Order> state = new GridStateHandler<Order>(grid);
//Set hidden fields to the state manually.