Results 1 to 4 of 4

Thread: [FIXED] GRID restore state bug

    You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default [FIXED] GRID restore state bug

    When hidding a column from the grid, that was previously already saved in the grid's state as the "sortField", GXT fails to restore the grid when next the application is started.

    I fixed this by overriding Grid. In the overridden class I overwrote applyState(), with the following code (note: I marked my additions):
    protected void applyState(Map<String, Object> state) {
    for(ColumnConfig c: cm.getColumns()) {
    String id = c.getId();
    if(state.containsKey("hidden" + id)) {
    if(id.equals((String)state.get("sortField"))) //Added
    state.remove("sortField"); //Added
    c.setHidden((Boolean)state.get("hidden" + id));
    if(state.containsKey("width" + id))
    c.setWidth((Integer)state.get("width" + id));
    String sortField = (String)state.get("sortField");
    if(store.getLoader() == null && sortField != null) {
    String sortDir = (String)state.get("sortDir");
    SortDir dir = SortDir.findDir(sortDir);
    store.sort(sortField, dir);

    This works for me. There are probably other ways to prevent this bug from showing (for example by adding checks on the store's sort method. Either way, I hope that this is fixed in a next release.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007


    Thanks for reporting this. It is fixed in SVN now

  3. #3
    Ext User
    Join Date
    Jul 2009

    Default Grid Restore State

    I have given "stateful: true," in the GridPanel. I can hide columns and save it in cookies. I would like to have a restore button, clicking on which should show me the default selected columns. How can i call applyState function to restore the hidden columns? Can anyone give me an example?

  4. #4
    Ext User
    Join Date
    Sep 2008


    i see you look more for a extjs solution than a gxt solution. so its the wrong category in thins forum.
    This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.

    GreaseMonkey Script for a GXT-only Forum: it hides ExtJs here: New Posts Search Results Advanced Search form Category overview

Posting Permissions

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