I have created a custom CellTable header as described in this thread: CellTable with custom Header containing SearchBox and Focus Problem
To go around the focus problem, i use the change event instead of the keyup event to trigger the filtering, so filter is now triggered only when the filter box looses its focus or Enter key is pressed.
The only problem I encountered is the filter box does not accept spaces (keycode=32). Anyone experiencing this?
I had found out that the AbstractHasData class which is one of the parent classes of the CellTable uses SPACE, HOME, END, ARROW UP, and ARROW DOWN for table navigation, this prevents those keys to perform its default functionality on a cell.
The keyboard navigation is only suppressed when cellIsEditing is TRUE which only happens when a cell on the Table's body is in focus and on edit mode.
Unfortunately since CellTable originally does not support input boxes on the header, there is also no support for cellIsEditing on the header.
As a workaround, I had created a private field headerIsEditing in my own extension of the CellTable class, this by default is set to FALSE. Then I had overridden the onBrowserEvent2 method, to set headerIsEditing to TRUE when the filter input box is in focus and set it to FALSE when blur event for the same box happens.
Then I had overridden isKeyboardNavigationSuppressed as shown below:
@Override
protected boolean isKeyboardNavigationSuppressed() {
return super.isKeyboardNavigationSuppressed() || headerIsEditing;
}
With this, keyboard navigation is suppressed when cellIsEditing is TRUE OR headerIsEditing is TRUE.