Search code examples
extjsextjs4

Grid.reconfigure not working in extjs


I have a reset button for my grid that is supposed to reset all my columns. Code looks like this :

               function (response) {
                    if (response == 'yes') {

                        Ext.state.Manager.clear(grid.stateId);

                        var cols = grid.initialConfig.columns

                        grid.reconfigure(grid.getStore(), cols);
                    }
                });

grid.reconfigure(..) is supposed to reset how the table looks, however nothing happens when I run the code above.

I noticed that grid.initialConfig.columns is undefined. Why would this be undefined? Is there some kind of initial configuration that needs to be set first?

(I notice that when using a constructor you can define an initialConfiguration. I used initComponent instead.)


Solution

  • In my initComponent(..) for my grid I added this.initialConfig.columns = this.columns

    initComponent : function (){
        var me = this;
    
        this.columns = createColumns();
    
        this.initialConfig.columns = this.columns;
    

    This has fixed column issues :) But it doesn't reset sorting :(