Unfortunately there is no quick way to do this, you will need to search for the
element by hand.
private int indexOf(final Element target) {
final TableElement table = TableElement.as(getElement());
final NodeList<TableRowElement> rows = table.getRows();
final NodeList<TableCellElement> cells = rows.getItem(0).getCells();
final int length = cells.getLength();
for(int i = 0; i < length; i++) {
if(cells.getItem(i).isOrHasChild(target)) {
return i;
}
}
return -1;
}
Hope that helps a bit.
//J
Riyaz Mansoor wrote:
>
> I have attached a ClickHandler to a HorizontalPanel and it recieves
> events.
>
> How can I find the index of the cell that generated the event?
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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
-~----------~----~----~----~------~----~------~--~---