PDA

View Full Version : [CLOSED] [1.2.4] CheckBoxSelectionModel with EditorGrid - cannot select multi



fother
20 May 2009, 4:08 AM
When created a editor grid using checkbox selection you cannot selection multi lines.. only if you click in a checkbox that its on header of the grid..

code example


package test.client;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.samples.resources.client.TestData;
import com.extjs.gxt.samples.resources.client.model.Stock;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class Example implements EntryPoint {

public void onModuleLoad() {

List<Stock> stocks = TestData.getStocks();

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

CheckBoxSelectionModel<Stock> sm = new CheckBoxSelectionModel<Stock>();

configs.add(sm.getColumn());

ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Company");
column.setWidth(300);
column.setEditor(new CellEditor(new TextField<String>()));
configs.add(column);

column = new ColumnConfig();
column.setId("symbol");
column.setHeader("Symbol");
column.setWidth(100);
configs.add(column);

column = new ColumnConfig();
column.setId("last");
column.setHeader("Last");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75);
configs.add(column);

column = new ColumnConfig("change", "Change", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
configs.add(column);

ListStore<Stock> store = new ListStore<Stock>();
store.add(stocks);

ColumnModel cm = new ColumnModel(configs);

ContentPanel cp = new ContentPanel();
cp.setHeading("Framed with Checkbox Selection and Horizontal Scrolling");
cp.setFrame(true);
cp.setIconStyle("icon-table");
cp.setLayout(new FitLayout());
cp.setSize(600, 300);

EditorGrid<Stock> grid = new EditorGrid<Stock>(store, cm);
grid.setSelectionModel(sm);
grid.setBorders(true);
grid.addPlugin(sm);

cp.add(grid);

RootPanel.get().add(cp);
}
}

sven
20 May 2009, 4:10 AM
Please use the forum search. This was reported before and is not a bug.