PDA

View Full Version : [CLOSED] LiveGridView bug



SopGreg
22 Oct 2010, 2:07 AM
Hi,

there's a bug in the current LiveGridView implementation:



LiveGridEvent<ModelData> event = (LiveGridEvent<ModelData>) createComponentEvent(null);
fireEvent(Events.LiveGridViewUpdate, event);


The newly created event is missing the page size property, it can be fixed like this:



LiveGridEvent<ModelData> event = (LiveGridEvent<ModelData>) createComponentEvent(null);
event.setPageSize(rowCount);
fireEvent(Events.LiveGridViewUpdate, event);


I noticed this because the LiveToolItem requires this value, and without it being set it displays something like
"Displaying 5 to 4 of 200"

regards

sven
22 Oct 2010, 2:09 AM
This should already be fixed in SVN

SopGreg
22 Oct 2010, 2:45 AM
I just checked out from releases/2.2 and it's not fixed, the LiveGridView class has the commit revision 2259 from October, 12th

sven
22 Oct 2010, 2:46 AM
The event gets the information live. No need to set it.

SopGreg
22 Oct 2010, 2:50 AM
Ah I see, but it seems wrong:



private int pageSize;

public int getPageSize() {
if (pageSize == -1) {
pageSize = ((LiveGridView) getGrid().getView()).getVisibleRowCount();
}
return pageSize;
}
}


Since primitive ints are initialized to 0, the path if (pageSize == -1) will never be executed

sven
22 Oct 2010, 2:55 AM
I had an outstanding commit for this. This is also corrected now. Thats also why it was working for me.