Results 1 to 5 of 5

Thread: GridPanel.applyState() wipes out sortable property in ColumnModel

    Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Ext JS Premium Member sumit.madan's Avatar
    Join Date
    May 2009
    Bangalore, India

    Default GridPanel.applyState() wipes out sortable property in ColumnModel

    One difference between ExtJS 3.2.1 and ExtJS 3.3.2 is that GridPanel.applyState() function has changed. Now[i].sortable is one of the properties which is restored from a saved state.

    This assumption is incorrect, as a user has no control to turn a column sortable state on / off from the GUI and the columns can by dynamically loaded and their sort property configured at runtime. Now the applyState() function forces the state to have a sortable property, otherwise it sets it as false, even though the columnModel has it as true.

    ExtJS 3.2.1 correctly considered the sortable property outside of state save/restore facility and only set the columnModel hidden and the width properties.

    ExtJS 3.3.2 behavior results in situations when the dynamically configured columnModel sortable value conflicts with the saved state of a grid and the applyState() function incorrectly sets the value.

    Although, a user can choose which columns to hide/show and change the width of the columns, he does not need to bother about whether a column is sortable or not, it is best left to the grid columnModel which can be dynamically configured.

    Here's the patch to correct the behavior in ExtJS 3.3.2
    Ext.override(Ext.grid.GridPanel, {
         applyState : function(state) {
            var cm = this.colModel,
                cs = state.columns,
                store =,
                for(var i = 0, len = cs.length; i < len; i++){
                    s = cs[i];
                    c = cm.getColumnById(;
                        colIndex = cm.getIndexById(;
                        cm.setState(colIndex, {
                            hidden: s.hidden,
                            width: s.width,
                            sortable: c.sortable
                        if(colIndex != i){
                            cm.moveColumn(colIndex, i);
                s = state.sort;
                    store[store.remoteSort ? 'setDefaultSort' : 'sort'](s.field, s.direction);
                s =;
            var o = Ext.apply({}, state);
            delete o.columns;
            delete o.sort;
  , o);

  2. #2
    Sencha User
    Join Date
    Apr 2007

    Default Lolz

    This issue still exists in ExtJS 3.4.
    Thank you lazy dev team for ruining my day.

  3. #3
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Baltimore, MD


    I'm really surprised to see that this bug still exists in 3.4.0 - guess it just slipped through the cracks.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    I have opened this as a ticket. We are finalizing wording but looks to be that we will be doing bug fixes for 3.4.x for a little while longer.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:

  5. #5
    Sencha Premium Member
    Join Date
    Sep 2010


    I just discovered grid state -- nice! Then I suffered for a while due to this bug!

Similar Threads

  1. Replies: 7
    Last Post: 29 Jan 2016, 7:54 AM
  2. Replies: 2
    Last Post: 16 Feb 2011, 1:09 PM
  3. gridpanel is sortable, able to add columns, not draggable/resizable
    By Skippy565 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 6 Dec 2010, 1:57 PM
  4. Replies: 0
    Last Post: 14 Sep 2010, 10:25 AM
  5. Replies: 1
    Last Post: 28 Jul 2010, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts