simeon
6 Nov 2011, 2:32 PM
I have a list panel.
When I load the store it displays properly
when I call load on the store a second time with a search constraint it returns less records.
The doRefresh method has a bug in it that results in the displayed results being the html from the previous list.
doRefresh: function(me) {
var store = me.getStore(),
records = store.getRange(),
items = me.getViewItems(),
recordsLn = records.length,
itemsLn = items.length,
deltaLn = recordsLn - itemsLn,
i, item;
// No items, hide all the items from the collection.
if (recordsLn < 1) {
me.onStoreClear();
return;
}
// Too many items, hide the unused ones
if (deltaLn < 0) {
this.moveItemsToCache(itemsLn + deltaLn, itemsLn - 1);
//return;
// Have to comment out the return here or you will never be able to update the ui with a data set smaller then the previous data set.
}
// Not enough items, create new ones
else if (deltaLn > 0) {
this.doCreateItems(store.getRange(itemsLn), itemsLn);
}
// Update Data and insert the new html for existing items
// itemsLn has a length that matches the previous load data set and needs to be items.length
// This is the old verison -> for (i = 0; i < itemsLn; i++) {
// this one works correctly
for(i=0;i<items.length;i++)
{
item = items[i];
me.updateListItem(records[i], item);
}
},
When I load the store it displays properly
when I call load on the store a second time with a search constraint it returns less records.
The doRefresh method has a bug in it that results in the displayed results being the html from the previous list.
doRefresh: function(me) {
var store = me.getStore(),
records = store.getRange(),
items = me.getViewItems(),
recordsLn = records.length,
itemsLn = items.length,
deltaLn = recordsLn - itemsLn,
i, item;
// No items, hide all the items from the collection.
if (recordsLn < 1) {
me.onStoreClear();
return;
}
// Too many items, hide the unused ones
if (deltaLn < 0) {
this.moveItemsToCache(itemsLn + deltaLn, itemsLn - 1);
//return;
// Have to comment out the return here or you will never be able to update the ui with a data set smaller then the previous data set.
}
// Not enough items, create new ones
else if (deltaLn > 0) {
this.doCreateItems(store.getRange(itemsLn), itemsLn);
}
// Update Data and insert the new html for existing items
// itemsLn has a length that matches the previous load data set and needs to be items.length
// This is the old verison -> for (i = 0; i < itemsLn; i++) {
// this one works correctly
for(i=0;i<items.length;i++)
{
item = items[i];
me.updateListItem(records[i], item);
}
},