Thursday, November 29, 2012

Re: CellTable - how to avoid unnecessary onRangeChange events?

Hi Rafael,

thank you for offering me your solution.
But in the meantime I found a very simple solution:

The application has to set the new range *before* a call to updateRowCount is made!

The first thing I do right after the data source (chat room) changed is to load the new row count.
But *before* passing this new row count to the data provider (which would trigger an onRangeChange event then), I set the range myself to a valid interval.
Finally, *after* this, I call updateRowCount.

Pseudocode: 

void onSelectChatRoom:()
{
 loadNewRowCount ();
}

void onLoadNewRowCount (int cnt)
{
 Range r = getLastPageRangeForCurrentRoom(cnt);
 tbl.setVisibleRangeAndClearData (r,true); // triggers one onRangeChange event

 pvd.updateRowCount (cnt); // does not trigger a second onRangeChange event anymore!
}

HTH
Magnus

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/JvAp1txQgTEJ.
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