tprice
23 Jan 2012, 2:56 PM
I have an EditorGrid that I would like to initially displayed in an editing mode with the cursor focused on the first cell that has a CellEditor.
Here is some example code of how I'm setting up my editor and grid:
// build the combo boxListStore<MyComboModel> comboStore = SenchaQuestions.SAMPLE_COMBO_STORE;
final ComboBox<MyComboModel> combo = new ComboBox<MyComboModel>();
combo.setForceSelection(true);
combo.setTypeAhead(true);
combo.setValueField("id");
combo.setDisplayField("name");
combo.setStore(comboStore);
// create the CellEditor
CellEditor comboEditor = new CellEditor(combo) {
// .. @Overrides preProcessValue and postProcessValue to go from Strings to models
}
// build the grid
List<ColumnConfig> columnConfigs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig("a_model_property", "Column To Edit", 250);
column.setEditor(editor);
columnConfigs.add(column);
ListStore<MyGridModel> store = SenchaQuestions.SAMPLE_GRID_STORE;
EditorGrid<MyGridModel>grid = new EditorGrid<MyGridModel>(store, new ColumnModel(columnConfigs));
How can I get the first cell of the "Column To Edit" to be focused?
Here is some example code of how I'm setting up my editor and grid:
// build the combo boxListStore<MyComboModel> comboStore = SenchaQuestions.SAMPLE_COMBO_STORE;
final ComboBox<MyComboModel> combo = new ComboBox<MyComboModel>();
combo.setForceSelection(true);
combo.setTypeAhead(true);
combo.setValueField("id");
combo.setDisplayField("name");
combo.setStore(comboStore);
// create the CellEditor
CellEditor comboEditor = new CellEditor(combo) {
// .. @Overrides preProcessValue and postProcessValue to go from Strings to models
}
// build the grid
List<ColumnConfig> columnConfigs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig("a_model_property", "Column To Edit", 250);
column.setEditor(editor);
columnConfigs.add(column);
ListStore<MyGridModel> store = SenchaQuestions.SAMPLE_GRID_STORE;
EditorGrid<MyGridModel>grid = new EditorGrid<MyGridModel>(store, new ColumnModel(columnConfigs));
How can I get the first cell of the "Column To Edit" to be focused?