Tuesday, September 21, 2010

Re: How do i get the row index and column index in each cell on mouse over event

Cell cell = view.getCellForEvent(event);
int row = cell.getRowIndex();
int col = cell.getCellIndex();

OR

private int getRowForEvent(MouseEvent<?> event)
{
Element td =
getEventTargetCell(Event.as(event.getNativeEvent()));
if (td == null)
{
return -1;
}

Element tr = DOM.getParent(td);
Element tbody = DOM.getParent(tr);
int row = DOM.getChildIndex(tbody, tr);

return row;
}

On Sep 21, 4:24 am, Ivan <lin.shihh...@gmail.com> wrote:
> Hi all,
>
>     I've searched much document about how to get the row index and
> column index on mouse over event, but i'still have no idea about that.
>     Can you give me some example code tell me how to do that ?
>
>     I can get element like below step, but how do i to get row index
> and column index ?
>
>         public void onBrowserEvent(Event event) {
>                 Element td = getEventTargetCell(event);
>         }
>
>     Thank you.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment