PDA

View Full Version : [CLOSED] [1.2.4] SelectionMode.MULTI is broken for EditorGrid



fes
7 May 2009, 2:51 PM
The problem looks the same as here (http://extjs.com/forum/showthread.php?t=60422&highlight=SelectionMode.MULTI), but for GridSelectionModel. Grid always works as SelectionMode.SINGLE.





import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Window;
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.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

public class App implements EntryPoint {

public void onModuleLoad() {
ContentPanel cp = new ContentPanel();
cp.add(createGrid());
RootPanel.get().add(cp);
}

private EditorGrid<BaseModel> createGrid() {

EditorGrid<BaseModel> grid = null;

ListStore<BaseModel> store = new ListStore<BaseModel>();

BaseModel bm = new BaseModel();
bm.set("name", "John Smith");

store.add(bm);

bm = new BaseModel();
bm.set("name", "Mary Smith");

store.add(bm);

bm = new BaseModel();
bm.set("name", "Paul Reed Smith");

store.add(bm);

// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
GridSelectionModel<BaseModel> selectionModel = new GridSelectionModel<BaseModel>();
selectionModel.setSelectionMode(SelectionMode.MULTI);

ColumnConfig cc = new ColumnConfig("name", "Name", 275);
cc.setAlignment(HorizontalAlignment.LEFT);
cc.setMenuDisabled(true);
columns.add(cc);

ColumnModel cm = new ColumnModel(columns);

grid = new EditorGrid<BaseModel>(store, cm);
grid.setSelectionModel(selectionModel);

grid.setAutoHeight(false);
grid.setAutoWidth(false);
grid.setWidth("700px");
grid.setHeight("200px");
grid.setStripeRows(true);
grid.setBorders(true);

return grid;
}

}

sven
7 May 2009, 3:07 PM
It is supporting it, but lowlevel, as the other thread already said.

But start edit selects the row you are editing. So i suggest to set the amount of clicks to start editing to two.

CLOSED

fes
8 May 2009, 5:30 PM
Sven, it does work as SINGLE. When i wand to select a few rows i click on one row then press and keep pressing Ctrl or Shift and then click on the other row. Now its doesn't work by one click or by double whatever clicks.

sven
9 May 2009, 1:25 AM
You need to set your grid to start editing nto with one click but with two.

fes
11 May 2009, 3:13 PM
Sven, I talk about selecting a few rows, not start editing them

sven
11 May 2009, 3:19 PM
I too ;)

Clicking on a row starts editing that row. While start editing all other selections get cleared and only the row that is edited gets selected.

So if you want to select multiply rows, you have to set the amount of clicks to start editing to two.

fes
11 May 2009, 5:05 PM
Thank You!