Thank you for reporting this bug. We will make it our priority to review this report.
-
Ext GWT Premium Member
[FNR] Version 2.2.3 Livegrid not working anymore with RpcProxy
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?
-
Ext GWT Premium Member
Detailed Example...
Here is my detailed example:
GXT: 2.2.3
GWT: 2.2.0
Developmode Tested
ClientPart
PHP Code:
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:
PHP Code:
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...
-
Sencha Premium Member
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.
-
Sencha Premium Member
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:
Code:
@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
-
That fix is not correct. Also it may fix the problem, it brings you several new problems
-
Sencha Premium Member
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
-
Ext GWT Premium Member
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?
-
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.
-
Ext GWT Premium Member
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.
-
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