Results 1 to 6 of 6

Thread: How to save/load Grid columns view state (hidden or not) in a cookie?

  1. #1

    Default How to save/load Grid columns view state (hidden or not) in a cookie?

    Hi

    So I've discovered ExtJS not a long time ago and I'm already in love with the GridPanel because it provides exactly what I need, however, there is one thing I absolutely need: since it provides a way to hide columns, I have to store it in a cookie so when the user comes back to the page, he gets only the columns he needs.

    Can anyone help me? I'm sure it's possible in ExtJS but I can't find the solution.

    Thanks,
    KTamas

  2. #2

    Default

    Anyone?...

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    You can access an array of columns directly on the column model:

    Code:
    var cm = myGrid.getColumnModel();
    Ext.each(cm.config, function(col, idx)
    {
       var isHidden = cm.isHidden(idx);
       //etc
    }
    );

  4. #4

    Default

    Quote Originally Posted by evant View Post
    You can access an array of columns directly on the column model:

    Code:
    var cm = myGrid.getColumnModel();
    Ext.each(cm.config, function(col, idx)
    {
       var isHidden = cm.isHidden(idx);
       //etc
    }
    );
    Is it possible to save the whole ColumnModel in a cookie? Or do I have to iterate through each item and save its state?

  5. #5

    Default

    Nevermind, solved the problem with evant's code and jQuery's cookie plugin. Thank you again, evant!

  6. #6

    Default

    ...or I could just say
    Code:
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    >.<

Posting Permissions

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