Here's my really hacky approach to creating an external "Edit" button that activates the editable fields of the selected record of a grid.
Is there really no way to lookup the selected record(s) and then call grid.startEditing() against those? For whatever reason:
Code:
private int lastSelectedRecord;
ToolStripButton editButton = new ToolStripButton("Edit");
editButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
grid.startEditing(lastSelectedLocationRecord);
}
});
ListGrid grid = new ListGrid();
grid.addRowMouseUpHandler(new RowMouseUpHandler() {
@Override
public void onRowMouseUp(RowMouseUpEvent event) {
lastSelectedRecord = event.getRowNum();
}
});
- startEditing() with no argument just starts editing the first record--ignoring my selection.
- ListGrid doesn't seems to support retrieval of selected record *numbers*--just ListGridRecord objects.
- startEditing() only accepts record *numbers* as input
Comment