PDA

View Full Version : Row/Column mouseover



iyeh
22 Nov 2009, 6:45 AM
how do I catch mouseover event on Grid cell or row?

Where do I add the listener? I tried adding a listener to ColumnConfig to handle Events.OnMouseOver, but it never fires.

sven
22 Nov 2009, 8:01 AM
Add the listener to the Grid directly

iyeh
22 Nov 2009, 8:13 AM
Added to grid directly, but although I get a GridEvent onMouseOver, event.getRowIndex() always return -1 or 0. I suspect because there is no selection?

What I need is DataModel for the row or column that was moused over. What I ended up doing is using GridCellRenderer to render a LayoutContainer, then add onMouseOver listener to the panel in order to retrieve data onmouseover. not desirable solution IMO since every column then would need the same design pattern for row mouseover to work.

sven
22 Nov 2009, 8:16 AM
Adding this to the "Basic Grid" example works like a charm:


grid.addListener(Events.OnMouseOver, new Listener<GridEvent<Stock>>(){

public void handleEvent(GridEvent<Stock> be) {
System.out.println(be.getRowIndex());

}

});

iyeh
22 Nov 2009, 8:24 AM
Ok thanks.

I will have to debug my grid to see why it always returns 0 onMouseOver.

pulkitagarwal
7 Jan 2011, 5:49 AM
TrackMouseOver in Grid ,

rowOverCls in Grid View ,

This will change the row css on hover