Here is some code you might also find applicable to your use case:
private void focusOnNext(final int currentRow, final int currentCol) {
// Scan remaining cells in table for a form element to focus on.
for (int r = currentRow; r < this.pricingTable.getRowCount(); r++) {
final NodeList<TableCellElement> rowCells =
this.pricingTable.getRowElement(r).getCells();
for (int c = 0; c < rowCells.getLength(); c++) {
if ((r == currentRow) && (c <= currentCol)) {
// don't process these cells since we would be moving
the
// focus backwards!
} else {
if (rowCells.getItem(c).getElementsByTagName("input")
.getItem(0) != null) {
rowCells.getItem(c).getElementsByTagName("input")
.getItem(0).focus();
return;
}
if (rowCells.getItem(c).getElementsByTagName("select")
.getItem(0) != null) {
rowCells.getItem(c).getElementsByTagName("select")
.getItem(0).focus();
return;
}
if (rowCells.getItem(c).getElementsByTagName("textarea")
.getItem(0) != null) {
rowCells.getItem(c).getElementsByTagName("textarea")
.getItem(0).focus();
return;
}
}
}
}
}
I call this method in my FieldUpdater after redrawing the row on a value
change. It works very nicely!
On Wednesday, July 25, 2012 11:26:04 AM UTC+2, Nitin wrote:
>
> In the cell table to have tab flow working, I had to do the
> following:
> cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
>
> apart from changing the template of TextInputcell. This helped me in
> getting the tab flow working properly i.e. when I hit TAB the focus shifts
> to the next editable cell of the celltable.
>
> But there is one more requirement in my project which says that the enter
> key should behave as the tab key and hence when we hit enter on a
> particular TextInputcell, the focus should move to the next TextInputcell
> of the celltable. Can anyone please help me with this?
>
> I have tried lots of things to achieve this, but none is working. This is
> very urgent for the project. Please let me know, if you need more
> information on the issue.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/75zP9aeD6GoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.