1. #11
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default Restore default configuration.

    Restore default configuration.


    if you want the option to restore default settings, I use this code (a function that returns the default column model so we aren't passing in a reference that would be changed by the grid):

    function defaultColumnModel(){
    return [
    {
    id: 'request_row',
    header: 'Request ID',
    dataIndex: 'request_id',
    renderer: renderRequest,
    align: 'right',
    width: 90,
    sortable: true,
    columnIndex: 0,
    hidden: false
    },...
    ];
    }

    Then I add the button to the bottom toolbar to reload the old configuration:

    grid.getBottomToolbar().add([
    '->'
    , {
    text: 'Reset Column Configuration',
    handler: function () {
    grid.filters.clearFilters();
    grid.getColumnModel().setConfig(defaultColumnModel(), false);
    }
    }
    , {
    text: 'Clear Filter Data',
    handler: function () {
    grid.filters.clearFilters();
    }
    }
    ]);

  2. #12
    Ext User
    Join Date
    Jul 2010
    Posts
    36
    Vote Rating
    0
    emmy mathew is on a distinguished road

      0  

    Default


    Please tell me how did you save the state of hidden columns in cookie?

  3. #13
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    98
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. Register a cookie provider:
    Code:
    Ext.state.Manager.register(new Ext.state.CookieProvider());
    2. Disable state management for all components by default:
    Code:
    Ext.Component.prototype.stateful = false;
    3. Enable state management for the grid:
    Code:
    stateId: 'mygrid',
    stateful: true
    4. Give all your columns an id (otherwise they will be stored by number, which would break if you ever add columns).

  4. #14
    Ext User
    Join Date
    Jul 2010
    Posts
    36
    Vote Rating
    0
    emmy mathew is on a distinguished road

      0  

    Default


    While using grid.getBottomToolbar().add ..shows error in firebug console

    function not defined....

  5. #15
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    98
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by emmy mathew View Post
    While using grid.getBottomToolbar().add ..shows error in firebug console

    function not defined....
    Which Ext version?

  6. #16
    Ext User
    Join Date
    Jul 2010
    Posts
    36
    Vote Rating
    0
    emmy mathew is on a distinguished road

      0  

    Default


    Ext 2.1

  7. #17
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    98
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Wow, that's old. Toolbars were completely redesigned in Ext 3, so you need different code for Ext 2.1 (you'll need to check the Ext 2.1 Toolbar API docs because I don't even remember how I did it back then).

  8. #18
    Ext User
    Join Date
    Dec 2007
    Posts
    3
    Vote Rating
    0
    ai2517 is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    1. Register a cookie provider:
    Code:
    Ext.state.Manager.register(new Ext.state.CookieProvider());
    2. Disable state management for all components by default:
    Code:
    Ext.Component.prototype.stateful = false;
    3. Enable state management for the grid:
    Code:
    stateId: 'mygrid',
    stateful: true
    4. Give all your columns an id (otherwise they will be stored by number, which would break if you ever add columns).
    Hi with 3.3.0 I cannot make resize and hiddenchange to work properly with above code. It works for column move and sorting but not for show/hide columns and resize. Is this still applicable or I need to do something more?

  9. #19
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    98
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by ai2517 View Post
    Is this still applicable or I need to do something more?
    Yes it is, but there is a bug in Ext 3.3.0 (see here).

  10. #20
    Ext User
    Join Date
    Dec 2007
    Posts
    3
    Vote Rating
    0
    ai2517 is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Yes it is, but there is a bug in Ext 3.3.0 (see here).
    Thanks Condor! Looks like I will need to wait until the fixed version is released.