You found a bug! We've classified it as EXTGWT-2316 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    10
    Vote Rating
    0
    premamonica is on a distinguished road

      0  

    Default Grid does not display after unhide of a hidden column ,from the grid state

    Grid does not display after unhide of a hidden column ,from the grid state


    Required Information

    Version(s) of Ext GWT
    Ext GWT 3.0 Release


    Browser versions and OS
    (and desktop environment, if applicable)
    • Firefox 13.0.1, Windows XP
    Virtual Machine
    No


    Description
    When the grid created has hidden columns by default, and if any of these hidden columns have be unhidden , the state for these are not restored after a refresh.

    Run mode
    both


    Steps to reproduce the problem
    1. Sample code below.
    Code:
     
    import java.util.ArrayList;
    import java.util.List;
    
    import rav.speclisting.client.common.BaseWidget;
    import rav.speclisting.modelbeans.Order;
    import rav.speclisting.modelbeans.OrderProperties;
    
    import com.google.gwt.core.client.GWT;
    import com.sencha.gxt.data.shared.ListStore;
    import com.sencha.gxt.state.client.GridStateHandler;
    import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
    import com.sencha.gxt.widget.core.client.grid.ColumnModel;
    import com.sencha.gxt.widget.core.client.grid.Grid;
     
    public class GridExample extends BaseWidget{
     
      private static final OrderProperties props = GWT.create(OrderProperties.class);
       
    
      public GridExample(List<Order> orderList) {
     
        ColumnConfig<Order, String> alloyCol = new ColumnConfig<Order, String>(props.codeAlloy(), 50, "Alloy");
        ColumnConfig<Order, String> finCol = new ColumnConfig<Order, String>(props.codeFinish(), 100, "FIN");
        ColumnConfig<Order, String> numberDOICol = new ColumnConfig<Order, String>(props.numberDOI(), 75, "Order#");
     
        numberDOICol.setHidden(true);
         
        List<ColumnConfig<Order, ?>> l = new ArrayList<ColumnConfig<Order, ?>>();
        l.add(alloyCol);
        l.add(finCol);
        l.add(numberDOICol);
       
        ColumnModel<Order> cm = new ColumnModel<Order>(l);
     
        ListStore<Order> store = new ListStore<Order>(props.key());
        store.addAll(orderList);
     
         
        final Grid<Order> grid = new Grid<Order>(store, cm);
        grid.getView().setAutoExpandColumn(alloyCol);
        grid.getView().setStripeRows(true);
        grid.getView().setColumnLines(true);
        grid.setBorders(false);
     
        grid.setColumnReordering(true);
        grid.setStateful(true);
        grid.setStateId("gridExample");
     
        GridStateHandler<Order> state = new GridStateHandler<Order>(grid);
        state.loadState();
     
        initWidget(grid);
      }
      
    }
    After running the above grid , un-hide the order# column which is set as hidden by default.
    Refresh page using F5

    Expected result
    Column "Order#" is not hidden


    Actual result
    Column "Order#" returns to the default hidden state.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,639
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Your example isn't runnable - We can't be sure what BaseWidget is doing for setup, and Order, OrderProperties are missing.

    The Basic Grid example at http://sencha.com/examples/#ExamplePlace:basicgrid uses state, and a column can be hidden in state. Specifying things that _aren't_ hidden hidden wasn't accounted for in the GridStateHandler - I'll file a bug so we can review this and how to make the change.

    As a possibility for a workaround, consider setting each column _via the ColumnModel_ instead of on the ColumnConfig - do it after the state wiring has been set up. This will add that hidden column to the state object, and it will track it as a hidden column, as if it was hidden by the user. The next step then is to make sure that you only do this if there is no state available for that grid - if there is, don't bother setting it, as the state should take over. Easiest way there is to ask the state manager for the grid's state - if it comes back as the default instance (with no Set<String> for hidden columns) then it hasn't been set, go ahead and hide it.

    We'll update this thread when we have a fix available in SVN.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    10
    Vote Rating
    0
    premamonica is on a distinguished road

      0  

    Default


    Thanks for the reply and the workaround. I will make sure going forward I include the Model and the properties as well. The idea behind the example was to show it is a very basic GXT grid, with a default hidden field, which would cause this issue. Also this was working with 2.X without the GridStateHandler.

    This bug can easily tested with the same example http://sencha.com/examples/#ExamplePlace:basicgrid , just by setting one of the ColumnConfig as hidden by default.

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    10
    Vote Rating
    0
    premamonica is on a distinguished road

      0  

    Default


    Hi Colin,

    I just tried the workaround suggested. Below is the modified piece of code.
    Code:
    GridStateHandler<Order> state =
    new GridStateHandler<Order>(grid); state.loadState(); //if the state does not exist, hide columns with defaults if(state.getState()==null || state.getState().getHidden()==null) { cm.findColumnConfig(props.numberDOI().getPath()).setHidden(true); cm.findColumnConfig(props.codeFinish().getPath()).setHidden(true);
    }


    Please let me know if the above code looks correct.

    The problem I still find with the above workaround is , when I unhide one of the above hidden field, the state has the hidden Set<String> created with no column name. So both of the hidden fields show up after refresh. Everything after these have showed up works fine. We have an existing PROD application which has around 60+ fields and on the initial load only has 20 fields which are visible. the users choose to customize their own views. After our upgrade to 3.0 , this functionality seems to be broken & would appreciate any help with it.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    10
    Vote Rating
    0
    premamonica is on a distinguished road

      0  

    Default


    I got this to work with manually setting the default hidden fields to the state. I do this only when the hidden Set<String> is empty. Below is the code.


    Code:
    final GridStateHandler<Order> state = new GridStateHandler<Order>(grid); state.loadState(); if(state.getState().getHidden()==null){ finCol.setHidden(true); numberDOICol.setHidden(true); //Set hidden fields to the state manually.
    Set<String> hiddenSet=
    new HashSet<String>(); hiddenSet.add(props.numberDOI().getPath()); hiddenSet.add(props.codeFinish().getPath()); state.getState().setHidden(hiddenSet); state.saveState();
    }

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar