Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab from input to input in CellTable

I have a CellTable with a bunch of cells that render to <input> tags. Tabbing between the inputs is broken because of CellTable's fancy event processing. It seems that tab inspires each cell to finishEditing, but that in turn hogs the focus and the focus never gets to the next <input>.

Setting tabIndex on each input does not seem to affect the behavior.

How can I restore the usual tabbing functionality?

like image 262
Riley Lark Avatar asked Dec 27 '22 21:12

Riley Lark


2 Answers

I recently figured this out. Annoying, but simple once you find the magic.

  1. Create a new Cell type to use in your table, as the stock TextInputCell specifies a tab index of -1. Basically do everything that TextInputCell does, but dont specify any tab index in your template.
  2. Disable the default keyboard navigation on your CellTable. cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED)

This should result in a normal tab navigation in your CellTable.

like image 88
Ben Imp Avatar answered Jan 06 '23 06:01

Ben Imp


Disabling KeyboardSelectionPolicy may not work on all views, if you are using any MVP frameworks. GWT selects the cell instead of the input field within the cell.

Here is a solution which I used in my applications: Adding TAB control to GWT CellTable

like image 36
pMan Avatar answered Jan 06 '23 08:01

pMan