PDA

View Full Version : [FNR] Version 2.2.3 Livegrid not working anymore with RpcProxy



emps
10 Apr 2011, 10:19 PM
In the new release has changed the behavior of the Livegrid.
When a empty List is returned by the RpcProxy the Livegrid doesn't get empty and calls the proxy each 2' second to fetch new data...
Because my RpcProxy Service fetches data from a database this repeated call is not very clever and also a empty Livegrid should be possible! How can i change to the old behavior?

emps
11 Apr 2011, 6:53 AM
Here is my detailed example:
GXT: 2.2.3
GWT: 2.2.0
Developmode Tested

ClientPart


public static final GreetingServiceAsync service = GWT.create(GreetingService.class);
String searchText = null;

PagingLoader<PagingLoadResult<ModelData>> gridloader = null;
Grid<ModelData> grid = null;
ListStore<ModelData> store = null;

public void onModuleLoad() {
ContentPanel cp = new ContentPanel();
final TextField<String> searchField = new TextField<String>();
searchField.addKeyListener(new KeyListener() {
@Override
public void componentKeyDown(ComponentEvent event) {
if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
searchText = searchField.getValue();
gridloader.load();
}
}
});
ToolBar tbar = new ToolBar();
tbar.add(new Html("seach: "));
tbar.add(searchField);

cp.setTopComponent(tbar);

RpcProxy<PagingLoadResult<ModelData>> proxy = new RpcProxy<PagingLoadResult<ModelData>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<ModelData>> callback) {
service.fetchDataPaged(searchText, (PagingLoadConfig) loadConfig, callback);
}
};

gridloader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
gridloader.setRemoteSort(true);
store = new ListStore<ModelData>(gridloader);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
configs.add(new ColumnConfig("name", "Name", 100));
configs.add(new ColumnConfig("age", "Age", 60));
grid = new Grid<ModelData>(store, new ColumnModel(configs));
grid.setPixelSize(250, 200);
LiveGridView liveView = new LiveGridView();
liveView.setEmptyText("No rows available on the server.");
liveView.setRowHeight(32);
grid.setView(liveView);

RootPanel rp = RootPanel.get("content");
cp.add(grid);
rp.add(cp);
}


ServerSide:


private ModelData genModel(String name, Integer age) {
BaseModel model = new BaseModel();
model.set("name", name);
model.set("age", age);
return model;
}

public PagingLoadResult<ModelData> fetchDataPaged(String searchText, PagingLoadConfig loadConfig) {
List<ModelData> sublist = new ArrayList<ModelData>();
if (searchText == null) {
sublist.add(genModel("Klaus", 123));
sublist.add(genModel("Maxy", 25));
sublist.add(genModel("Joey", 22));
sublist.add(genModel("Sissi", 1));

}
System.out.println("Load... ");
return new BasePagingLoadResult<ModelData>(sublist, loadConfig.getOffset(), sublist.size());
}


You see when enter some values in the searchfield and press enter then the endless "Load..." comes...
This is not the normal behavior...

hellofornow
18 Apr 2011, 8:10 AM
I'm having the same issues as emps.

Any request that returns no results causes the grid to infinitely load. Is there a fix available/in progress?

My hunch is something with loadLiveStore (LiveGridView.class) being tasked every 200ms.

hellofornow
20 Apr 2011, 11:17 AM
The break happened with the following:
"Fixed LiveGridView isCached returns true if cache is empty."

I have a class extending LiveGridView and am currently overriding the isCached method with the code from version 2.2.0:

@Override
protected boolean isCached(final int index) {
if ((index < liveStoreOffset) || (index > (liveStoreOffset + getCacheSize() - getVisibleRowCount()))) {
return false;
}
return true;
}
}


This has fixed the problem of infinite loop when receiving 0 objects from server

sven
20 Apr 2011, 10:23 PM
That fix is not correct. Also it may fix the problem, it brings you several new problems

hellofornow
21 Apr 2011, 6:41 AM
I've been using that code for a whole day now .. I've noticed no issues ..

May you provide a reason as to why you think that code brings several new problems? I would have to argue that the code from 2.2.3 brings me the worst problem of all -- an unusable grid

emps
27 Apr 2011, 12:30 AM
I've not tested hellofornow fix but he is right...
Currently the new version 2.2.3 is unusable because of this bug.
I've steped backward for my projects to gxt 2.2.1 ...

When will you post a fix for this bug?

sven
29 Apr 2011, 3:43 AM
I _contributed_ (yes contributed as everyone can do) several fixes to GXT for LiveGridView that fixes several issues i had in production application from my customers. This should also fix this one.

cswereda
26 May 2011, 7:39 AM
Sven, you fixed this? I downloaded and rebuilt revision 2391 and the problem still exists. I'm going to have to go back to the old method of isCached and manually doing load masks again if I can't find a better workaround.

sven
26 May 2011, 7:44 AM
The testcase i used was fixed. Where have you build GXT from? What directory in SVN have you used?

I found another problem which ends in end endless loop

sven
26 May 2011, 8:13 AM
I commited serveral other fixes for LiveGridVIew now, also another infinite loop fix.

cswereda
26 May 2011, 9:05 AM
Recompiled with your new update and it works properly again, Thanks

atrubka
23 Jun 2011, 11:14 AM
Sven, could you please point to the version that works?
Is it stable enough?

The latest 2.2.4 is not working properly.

sven
23 Jun 2011, 11:16 AM
There is no version yet released containing that latest fixes.

atrubka
23 Jun 2011, 11:17 AM
OK. So which one do I use then?

sven
23 Jun 2011, 11:29 AM
You can grab the latest one out of SVN, if you have a support subscription. Else you would need until there is another release or you need to downgrade again.

atrubka
23 Jun 2011, 11:35 AM
Previous version has its issues as well.
We don't have support subscription yet.
Our company is planning to purchase the subscription.
The decision is mainly based on how stable the GXT UI is, which is exactly what I'm trying to demonstrate.

Is it possible for you to provide a jar file of the new version?

sven
23 Jun 2011, 11:38 AM
This post (http://www.sencha.com/forum/showthread.php?129777-FNR-Version-2.2.3-Livegrid-not-working-anymore-with-RpcProxy&p=593492&viewfull=1#post593492), a part of this thread, has a workaround that should work for demonstrating purposes.

atrubka
23 Jun 2011, 11:46 AM
Thank you for the workaround.
What is the downside of this workaround?
Is it possible to turn automatic reloading off completely? In my case I only need updates upon scrolling.

atrubka
23 Jun 2011, 11:49 AM
If you could post the latest source for LiveGridView I could simply put it as another GridView implementation in my code. If the changes are isolated in the LiveGridView that should be sufficient for any complex use cases.

sven
23 Jun 2011, 12:20 PM
What is the downside of this workaround?


It could return that a model is cached, also its not, but only under a small amount of rare circumstances. This would lead to an incorrect view.

atrubka
23 Jun 2011, 1:48 PM
What is the plan for the release with the fixed LiveGridView?
Is it any time soon?

sven
23 Jun 2011, 1:51 PM
There are no public dates for GXT 2.2.5 yet.

atrubka
23 Jun 2011, 2:42 PM
I tested with the patch you mentioned.
It's even worse!!!!!!!!!!!!!!!!! :(
When you scroll down it simply hangs forever with the waiting mask.

This is nowhere near production quality code. We cannot demo anything with a grid like that.
We need a normal fix or workaround ASAP!

Please help us.