Results 1 to 3 of 3

Thread: Odd behavior with CheckBoxSelectionModel on Grid

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    51
    Vote Rating
    0
      0  

    Default Odd behavior with CheckBoxSelectionModel on Grid

    I have built a very simple grid with checkbox and name columns. For some reason the checkboxes themselves seem like they are read-only. I have to click the actual row to get the box to populate. This removes the ability to use the header checkbox to select/deselect all.

    Code that builds grid:
    Code:
        public void buildGrid() {
            IdentityValueProvider<SystemModuleDTO> indentity = new IdentityValueProvider<SystemModuleDTO>();
            final CheckBoxSelectionModel<SystemModuleDTO> sm = new CheckBoxSelectionModel<SystemModuleDTO>(
                    indentity);
    
            ColumnConfig<SystemModuleDTO, String> nameColumn = new ColumnConfig<SystemModuleDTO, String>(
                    props.getName(), 200, "Name");
    
            List<ColumnConfig<SystemModuleDTO, ?>> l = new ArrayList<ColumnConfig<SystemModuleDTO, ?>>();
    
            l.add(sm.getColumn());
            l.add(nameColumn);
    
            ColumnModel<SystemModuleDTO> cm = new ColumnModel<SystemModuleDTO>(l);
            ListStore<SystemModuleDTO> store = new ListStore<SystemModuleDTO>(
                    props.key());
    
            grid = new Grid<SystemModuleDTO>(store, cm);
            grid.setSelectionModel(sm);
            grid.getView().setAutoExpandColumn(nameColumn);
            grid.getView().setStripeRows(true);
            grid.getView().setColumnLines(true);
            sm.setSelectionMode(SelectionMode.MULTI);
    
            SystemModuleDTO sample = new SystemModuleDTO();
            sample.setId(1);
            sample.setName("Corporate Video");
            SystemModuleDTO sample2 = new SystemModuleDTO();
            sample2.setId(2);
            sample2.setName("Corporate Video");
            store.add(sample);
            store.add(sample2);
        }
    Video that shows my issue:


  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    Without a full runnable sample it is hard to say anything for certain, but my immediate guess is that you have duplicate or inconsistent keys in your model objects. Make sure that the props.key() is mapped to a value that is consistent and unique. GXT 3.0.3 or so and beyond enforce this with an assertion to make it harder to make that mistake.

    Beyond that, what version are you using? Can you reproduce this with the http://www.sencha.com/examples/#Exam...e:checkboxgrid sample by changing the code to be more like yours? Can you share a full, runnable test case that lets us reproduce the issue to help you track it down?

  3. #3
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Vote Rating
    21
      0  

    Default

    a dead giveaway that you do not have unique keys (if you're using GXT < 3.0.3) is when you click one checkbox, multiple ones become checked.

    i've never tried creating a checkbox grid with a nondeterministic ModelKeyProvider, but imagine the the nondeterministic behavior would carry over into the grid resulting in....um....more nondeterministic behavior.

Posting Permissions

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