-
26 Apr 2010 6:00 AM #1
SuggestBox as a CellEditor on grid not propogating selection to cell on 'return' key
SuggestBox as a CellEditor on grid not propogating selection to cell on 'return' key
Heya,
I have an editable grid that contains a SuggestBox in one of it's cells. All works as expected except in the scenerio when the user selects the value they require by hitting the enter key (as opposed to clicking the appropriate item with a mouse click). In this scenerio the underlying table cell div is not updated with the new contents. The appropriate selection events are being fired it's just not propagating the change to the underlying table cell:
final SuggestBox prevSuggestBox = new SuggestBox(new FilterSuggester()); // FilterSuggester is just a plain implementation of the SuggestOracle.
prevSuggestBox.setText("Enter ticker");
final CellEditor prevCellEditor = new CellEditor(new AdapterField(prevSuggestBox));
prevSuggestBox.addSelectionHandler(new SelectionHandler<Suggestion>() {
@Override
public void onSelection(SelectionEvent<Suggestion> event) {
prevSuggesstion = (ItemSuggestion) event.getSelectedItem();
MessageBox.alert("testing", "The message box appears on return key and mouse click", null);
}
});
ColumnConfig column = new ColumnConfig();
column.setId(MOVEMENT_TABLE_COL_PREV);
column.setHeader("Prev");
column.setWidth(90);
column.setEditor(prevCellEditor);
configs.add(column);
If anyone knows what might be causing this behaviour and could provide a fix for this i would be very grateful.
Thanks
Andy
-
27 Apr 2010 10:42 AM #2
Looks like it wasnt actually too hard in the end to get it working. This is not a fix to the underlying issue but a work around is like such:
Code:final SuggestBox prevSuggestBox = new SuggestBox(new FilterSuggester()); // FilterSuggester is just a plain implementation of the SuggestOracle. prevSuggestBox.setText("Enter ticker"); final CellEditor prevCellEditor = new CellEditor(new AdapterField(prevSuggestBox)); prevSuggestBox.addSelectionHandler(new SelectionHandler<Suggestion>() { @Override public void onSelection(final SelectionEvent<Suggestion> event) { prevSuggession = (ItemSuggestion) event.getSelectedItem(); MovementTableItem item = grid.getStore().getAt(prevCellEditor.row); item.set("Some col id", prevSuggession.getReplacementString()); grid.getView().refresh(false); } }); ColumnConfig column = new ColumnConfig(); column.setId(MOVEMENT_TABLE_COL_PREV); column.setHeader("Prev"); column.setWidth(90); column.setEditor(prevCellEditor); configs.add(column);
-
14 May 2010 11:48 AM #3
It looks like you are using the GWT SuggestBox. If so, I'm trying to think what this issue would have to do with GXT. Just curious, because I have implemented my own suggest box using GXT and don't have this problem.


Reply With Quote