Closed GoogleCodeExporter closed 8 years ago
Hi, I have the same problem and this problem is also with up and down arrows.
I'm using smartgwt 3.0 and internet explorer 10.0.9200
Original comment by dawstr1...@gmail.com
on 12 Apr 2013 at 10:12
I solved the problem using this tricky way:
onModuleLoad:
Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYDOWN) {
gridContainer.onPreviewKeyDown(event);
}
}
});
gridContainer:
public void onPreviewKeyDown(NativePreviewEvent event) {
if (event.getNativeEvent().getShiftKey() && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB) {
event.cancel();
activatePreviousField();
System.out.println("Shift+Tab");
} else if (!event.getNativeEvent().getShiftKey() && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB) {
event.cancel();
activateNextField();
System.out.println("Tab");
}
}
public void activateNextField() {
int selectedIndex = -1;
if (grid.getSelectedRecord() != null) {
selectedIndex = grid.getRecordIndex(grid.getSelectedRecord());
}
for (int i = 0; i < grid.getPropertiesCount(); i++) {
selectedIndex = (selectedIndex + 1) % grid.getPropertiesCount();
if (grid.canEditCell(selectedIndex, 1)) {
grid.focus();
grid.startEditing(selectedIndex, 1, false);
return;
}
}
}
public void activatePreviousField() {
int selectedIndex = -1;
if (grid.getSelectedRecord() != null) {
selectedIndex = grid.getRecordIndex(grid.getSelectedRecord());
}
for (int i = 0; i < grid.getPropertiesCount(); i++) {
selectedIndex = (selectedIndex - 1 + grid.getPropertiesCount()) % grid.getPropertiesCount();
if (grid.canEditCell(selectedIndex, 1)) {
grid.focus();
grid.startEditing(selectedIndex, 1, false);
return;
}
}
}
I know it's terrible.. :)
Ville
Original comment by vra...@gmail.com
on 12 Apr 2013 at 12:21
Hey, thanks for your solution but I've checked it and still I cannot make the
field editable. If I use startEditing and pass true as a last argument, the
cell is in edit mode but I can't type anything in this field unless I click on
that field.
Original comment by dawstr1...@gmail.com
on 30 Apr 2013 at 9:35
This was addressed Apr 14 for 3.0, 3.1 and 4.0.
Original comment by smartgwt...@gmail.com
on 30 Apr 2013 at 2:12
Original issue reported on code.google.com by
vra...@gmail.com
on 2 Nov 2012 at 2:02