Results 1 to 2 of 2

Thread: Problem in using grid and CheckBoxSelectionModel

  1. #1

    Default Problem in using grid and CheckBoxSelectionModel

    I'm having a problem in using a Grid with CheckBoxSelectionModel. I search on the forum and it seems like nobody has had the problem. I compare with the samples of the showcase but I can't find what I'm doing wrong.

    I have a grid on which I plug a CheckBoxSelectionModel in order to select some items of my list. The grid is correctly loaded and the checkboxes are available. The issue is that I can only select/deselect the first item. When I select the Select all/ Deselect all checkbox, the behaviour is similar.

    I attach a snippet

    Code:
     ContentPanel cp = new ContentPanel();
    		cp.setAnimCollapse(false);
    		cp.setHeading(constants.transport());
    
    		RpcProxy<ListLoadResult<TransportView>> proxy = new RpcProxy<ListLoadResult<TransportView>>() {
    
    			@Override
    			protected void load(Object loadConfig, AsyncCallback<ListLoadResult<TransportView>> callback)        
                            {
    				ListLoadConfig listLoadConfig = (ListLoadConfig) loadConfig;
    				listLoadConfig.set("identifier", 1);
    				userService.getFleetTransports(listLoadConfig, callback);
    			}
    		};
    
    		// Le loader
    		final ListLoader<ListLoadResult<TransportView>> loader = new          
                    BaseListLoader<ListLoadResult<TransportView>>(proxy);
                    loader.load();
    
    		// Le store
    		ListStore<TransportView> store = new ListStore<TransportView>(loader);
    
    		// Creation de la colonne
    		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
    		CheckBoxSelectionModel<TransportView> sm = new CheckBoxSelectionModel<TransportView>();
    		sm.setSelectionMode(SelectionMode.MULTI);
    
    		configs.add(sm.getColumn());
    		ColumnConfig column = new ColumnConfig("name", "Name", 100);
    		configs.add(column);
    		
    		ColumnModel cm = new ColumnModel(configs);
    		Grid<TransportView> grid = new Grid<TransportView>(store, cm);
    		grid.setBorders(true);
    		grid.setAutoHeight(true);
    		grid.setSelectionModel(sm);
    		grid.addPlugin(sm);
    
    		cp.add(grid);
    I'm using GXT 2.1.1

  2. #2

    Default

    I finally find what I'm doing wrong. My ModelData (TransportView) has override hashCode and equals methods and the comparison is made on a particular field on which I don't set value. So the items were considered equals although they were not. Thanks

    I also think that this thread could be closed!

Similar Threads

  1. CheckBoxSelectionModel With Locking Grid Problem
    By srinivasp in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 25 May 2010, 8:28 AM
  2. Problem with a grid CheckboxSelectionModel
    By dark_1001 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Nov 2009, 10:36 AM

Posting Permissions

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