Hi,
I use SmartGWT 4.0 with Firefox 24.8.1, I could not find a solution to set the focus in a different column in an editing row in a ListGrid after calling startEditingNew().
The goal is to set a default value in the first column and set the focus to the second one in the current editing row.
I even tried to set an empty string into the second column to gain the focus but was not successful. I don't know what am I missing. A solution or workaround would be appreciated.
I use SmartGWT 4.0 with Firefox 24.8.1, I could not find a solution to set the focus in a different column in an editing row in a ListGrid after calling startEditingNew().
The goal is to set a default value in the first column and set the focus to the second one in the current editing row.
Code:
private RowEditorEnterHandler rowEditorEnterHandler = new RowEditorEnterHandler() {
@Override
public void onRowEditorEnter(RowEditorEnterEvent event) {
// getting the Row and Column of the new editing row
ListGrid myGridList = event.
int row = myGridList.getEditRow();
int col = myGridList.getEditCol();
ListGridRecord rec = myGridList.getRecord(row);
if (rec == null) {
// it is a new inserted row.
// Setting the default name for the new added Row.
String defaultName = getDefaultName();
myGridList.setEditValue(row, col, defaultName);
FormItem f = myGridList.getEditFormItem(0);
f.blurItem();
f = myGridList.getEditFormItem(1);
f.focusInItem(); // <-- does not work
f.getForm().focusInItem(1); // <-- does not work
f.getForm().focusInNextTabElement(); //<-- throws an exception
}
}
};