PDA

View Full Version : Aggregation Row Events



mnilson
20 Dec 2010, 8:06 AM
Is it possible to listen to events from the Aggregation Row / Column Footer? I am listening to the RowClick event and CellMouseDown event on my grid and would like these events to be fired form the footer too. Is it possible? I tried the javadoc and searing the forum and had no luck so I appologize if I missed the info.

thanks,
Mike

sven
21 Dec 2010, 5:41 AM
You can do it like this for example:
grid.addListener(Events.OnClick, new Listener<GridEvent<Stock>>() {

public void handleEvent(GridEvent<Stock> be) {
if (be.getRowIndex() == -1 && be.getTarget(".x-grid3-footer-cell", 5) != null) {
System.out.println(be.getColIndex());
}

}
});

mnilson
21 Dec 2010, 12:05 PM
This doesn't seem to be working properly for me. I can get it to work in the OnClick method, but the column index is -1 no matter where I click. I was hoping to use an event that fires before the click completes (ie OnMouseDown) but that doesn't seem to fire the event. I am running gxt 2.1.1

sven
21 Dec 2010, 5:28 PM
I tested this against 2.2.1 again and it works for me.

mnilson
22 Dec 2010, 6:12 AM
I tested this against 2.2.1 again and it works for me.

Have you tested against 2.1.1? Just to clarify, are you saying that the event fires with the column number correctly being identified, or that an OnMouseDown event fires, or both?

thanks again,
Michael

sven
22 Dec 2010, 6:14 AM
column index is correctly and onmousedown works too.

From the 2.2.0 beta release notes:
Fixed GridEvent of an aggregation row does not contain the column index.



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

public void handleEvent(GridEvent<Stock> be) {
if (be.getRowIndex() == -1 && be.getTarget(".x-grid3-footer-cell", 5) != null) {
System.out.println(be.getColIndex());
}

}
});

mnilson
22 Dec 2010, 6:20 AM
Thanks Sven, I hadn't thought to check the release notes. Appreciated.