PDA

View Full Version : Editable grid



Estefan
30 Aug 2009, 10:19 PM
hi
I am using an editable grid that contains contains three columns including a checkBox column.I followed up the "Editable grid" example but the problem is that i am not getting the checkBox checked until i double click on it.
How can i fix it so that i will get the checkBox checked after one click?
Thanks.

Arno.Nyhm
31 Aug 2009, 3:53 AM
did it works in the examples with single click?

when it works in the examples explorer, then a error is in your code. without a full working sample nobody can help you.

Estefan
31 Aug 2009, 4:04 AM
Thanks a lot but i am just copy pasting the code.
here it is:

final ListStore<GroupModel> store = new ListStore<GroupModel>();
store.add(TestData.getModel());

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

CheckColumnConfig checkColumn = new CheckColumnConfig("", "in", 55);
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
checkColumn.setEditor(checkBoxEditor);
columns.add(checkColumn);

ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader(myMessages.Groups());
column.setWidth(100);

text = new TextField<String>();
text.setAllowBlank(false);
column.setEditor(new CellEditor(text));
columns.add(column);

ColumnModel cm = new ColumnModel(columns);

// create a grid and add it to the window
grid = new EditorGrid<GroupModel>(store,
cm);
grid.setAutoExpandColumn("name");
grid.addPlugin(checkColumn);
grid.addPlugin(sm);

window.add(grid)

thanks in advance

Arno.Nyhm
31 Aug 2009, 5:01 AM
i guess this from your code:

the first click you need to activate the editor. and the second click makes the check.


maybe the CheckBoxSelectionModel fit more your need?

http://extjs.com/examples/explorer.html#gridplugins

Arno.Nyhm
31 Aug 2009, 5:07 AM
maybe this is also interesting for you:

http://www.extjs.com/examples-dev/explorer.html#editablegrid
http://www.extjs.com/examples-dev/explorer.html#roweditorgrid


Note:
this are the explorer in development status. but the are sources of this examples included in the gxt-2.0.1.zip but not on the normal gxt explorer:

package com.extjs.gxt.samples.client.examples.grid;
-> RowEditorExample.java
-> EditableGridExample.java

Estefan
2 Sep 2009, 11:40 PM
Thanks Arno.Nyhm

I checked all your links and i solved the problem.
In order to get rid of the double click in order to have a checkbox checked,you have to initialize them in the Model.They are boolean variables.So i set all of them to false or unchecked and now i can check anyone using one click.