eudoxem
4 Aug 2010, 5:31 AM
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
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
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
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