Hello,
I have a GameListPanel that shows a list of games. It uses a CellTable to
provide the list. The panel also has a method "setFilter", which allows to
set a filter so that only certain games are displayed.
The intended usage is like this:
GameListPanel p = new GameListPanel ();
p.setFilter (myFilter);
However, this causes the CellTable to load the data twice (see below). This
would be ok for me, but the data arrives out of order! After executing the
code above the list contains "all" games, not the filtered one.
I believe that this is a synchronization problem. First, on construction of
the panel, a RPC request is made to fetch "all" games. Then, when setFilter
is called, a RPC request is made to fetch a subset of all games. Maybe the
retrieval of all games needs so much time that the answer to the first RPC
call returns after the other. I also tried to schedule the reload method
below.
How can I ensure that the data arrives in order?
If this is not possible, another solution would be to suppress any data
retrieval within the GameListPanel constructor (see method initList below),
so that the call to setFilter is the only action that causes data retrieval.
What else can I do?
Thanks
Magnus
----------
Here is what happens within the GameListPanel constructor and the setFilter
method:
The constructor of GameListPanel creates the CellList and attaches it to a
AbstractDataProvider, which in turn causes the list to be loaded:
private void initList ()
{
tbl = new CellTable<Game>();
initListColumns ();
tbl.setPageStart (0);
tbl.setPageSize (PAGESIZE);
provider.addDataDisplay(tbl);
Pager p = getPager ();
p.setDisplay(tbl);
p.setRangeLimited(true);
loadRecordCount ();
}
The call to setFilter causes the CellTable to reload the data, like this:
public void reload ()
{
provider.updateRowCount (2,true); // test
Range r = tbl.getVisibleRange();
tbl.setVisibleRangeAndClearData (r,true);
Pager p = getPager ();
p.firstPage();
loadRecordCount ();
}
--
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/-/aNWWllmyhzgJ.
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.