gwtgwt-2.2-celltable

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?


Solution

  • 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.