PDA

View Full Version : LiveGridView doesn't refresh display when store is empty



ppoulard
9 Mar 2011, 8:10 AM
Hi,

I use GWT 2.2 and GXT 2.2.3
I know how to populate a grid from my XML data, but with the new version of GXT 2.2.3, a live grid doesn't work any longer when the data store becomes empty.

There is a form with fields that are used as criteria for getting XML data that I use to populate a list:

List<ModelData> list = ...
BasePagingLoadResult<ModelData> result = new BasePagingLoadResult<ModelData>(list, loadConfig.getOffset(), totalRow);

Everything works fine as long as some rows has been fetched from the server, but if the list is empty, the grid still displays the old data, whereas the behaviour expected would to display an empty grid (that was working with the previous version)

I tried various turnaround such as getting the store and removing all entries, sending some events to cause refreshing the grid but nothing work and I still have the old data displayed in the grid.
So far the only thing that works is adding a dummy row in the store, but the columns renderers are not designed to render it correctly, and the total of rows displayed becomes 1 instead of 0, so there are too much side effects => bad solution

I think it's a bug in the new version, but I'd like to know if there is some way to have no rows displayed in my grid; even by hacking the current code.

Thanks for your help.
Philippe

ppoulard
9 Mar 2011, 8:35 AM
Hi all,

Here is my implementation of a live grid view that correct the bug mentionned:


LiveGridView liveView = new LiveGridView() {
// see bug http://www.sencha.com/forum/showthread.php?125792-LiveGridView-with-empty-store
@Override
protected boolean isCached(int index) {
if ((index < liveStoreOffset) || (index > (liveStoreOffset + getCacheSize() - getVisibleRowCount()))) {
return false;
}
return true;
}
// see bug http://www.sencha.com/forum/showthread.php?126291-LiveGridView-doesn-t-refresh-display-when-store-is-empty
@Override
protected void updateRows(int newIndex, boolean reload) {
super.updateRows(newIndex, reload);
if (this.ds.getCount() == 0) {
applyEmptyText();
}
}
};