PDA

View Full Version : [FIXED-213] List not refreshing snapshot when calling loadRecords



meyerovb
10 Aug 2010, 12:59 PM
As can be seen below, after modifying the store by calling loadData, the snapshot is not updated to reflect the latest clean data source, but instead represents the first loaded data source. I'm doing advanced filtering in my application (because NestedList is not yet inheriting from list, so I'm basically coding NestedList with filters). To workaround for now I am calling "delete store.snapshot;" before "store.loadData(..."



Ext.setup({ onReady: function () {
var data = [];
for (var x = 0; x < 100; x++) data[data.length] = { html: x };
new Ext.List({
fullscreen: true,
store: new Ext.data.Store({ fields: ['html'] }),
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{html}</div></tpl>'),
itemSelector: '.list-item',
dockedItems: [{ dock: 'top', xtype: 'button', text: 'shorten list',
handler: function () {
var store = this.ownerCt.getStore();
store.loadData([{ html: 'invisible'}]);
alert(store.snapshot.getCount());
}
}]
}).getStore().loadData(data);
}});

Jamie Avins
11 Aug 2010, 9:41 AM
Nice, two bugs with the same example.

meyerovb
11 Aug 2010, 9:45 AM
Just out of curiosity... what's the second bug? I'm assuming the first one is that snapshot is not maintained correctly in loadRecords

Jamie Avins
11 Aug 2010, 9:54 AM
http://www.sencha.com/forum/showthread.php?106742-OPEN-212-List-not-reducing-scroll-position-after-reload

You changed the handler, but the sample is the same.

blessan
25 Aug 2010, 9:45 PM
I didnt really understand this issue. Im have problem to get the store sorted after I add new records.

edspencer
3 Sep 2010, 7:38 PM
I've refactored this to add records via store.add instead of the custom adding logic that used to exist inside loadData. This alleviates the snapshot issue and should standardize the loading process further.

netresource
28 Mar 2012, 12:19 AM
I got this issue in my app (ST 1.1)
how to fix it?
thanks!

netresource
28 Mar 2012, 12:29 AM
thank meyerovb,
i resolved my problem