I actually ended up using addCellPreviewHandler of the celltable to add
a CellPreviewEvent.Handler for the table.
thanks

On Thu, May 12, 2011 at 11:21 AM, Boris Lenzinger <[email protected]
> wrote:

> Hi,
>
> I had found something like about this on the internet. The following code
> is some hint on how to do this.
>
> Boris
>
> class Table extends FlexTable {
>   private String headerStyle = "nostyle";
>
>   public Table(TableDataSource source, String stylePrefix) {
>       super();
>       this.setCellPadding(1);
>       this.setCellSpacing(0);
>       this.setWidth("100%");
>       this.setSource( source );
>
>       sinkEvents(Event.ONMOUSEOVER |
>           Event.ONMOUSEOUT);
>   }
>
>
>   //
> ==========================================================================
>   public void onBrowserEvent(Event event) {
>           Element td = getEventTargetCell(event);
>           if (td == null) return;
>           Element tr = DOM.getParent(td);
>           switch (DOM.eventGetType(event)) {
>                   case Event.ONMOUSEOVER: {
>                           DOM.setStyleAttribute(tr, "backgroundColor",
> "#ffce00");
>                           onRowRollover(tr);
>                           break;
>                   }
>                   case Event.ONMOUSEOUT: {
>                           DOM.setStyleAttribute(tr,
> "backgroundColor","#ffffff");
>                           break;
>
>               }
>       }
>
>   }
> }
>
> 2011/5/12 matttai <[email protected]>
>
>> Maybe attach the handler to the table and get the cell source when the
>> event is triggered.
>>
>> Get the row index from the returned cell, remove all highlight style
>> from the table and add a highlight style to the row.
>>
>> Not sure how efficient this would be though given the event would need
>> to be handled every time the cursor moves a pixel :)
>>
>> Would be interested to hear other ideas. Perhaps experimenting with
>> mouseOver will yield better results though I am not whether mouseOver
>> events continuously fire if the cursor is left in the handling area. I
>> don't think they do but thats just a guess :P
>>
>> Cheers,
>>
>> Matt
>>
>> On May 7, 4:41 am, SVR <[email protected]> wrote:
>> > Has anybody tried implementing MouseMove to highlight rows of the table?
>> If
>> > so, can you please share your ideas?
>> > thanks
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

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

Reply via email to