PDA

View Full Version : How do I get a Store to append new data, not replace its old data?



mikerthomsen
5 Mar 2010, 5:38 AM
This is the code I am using to tell the store to load new data and append it to the cache instead of removing it. When it executes, the dataview that is bound to it removes all of the old content and loads the new content instead like it's ignoring the "add" property passed into store.load.

currentSearchOffset += store.getCount();
store.setBaseParam('offset', currentSearchOffset);
lastOptions = store.lastOptions;
Ext.apply(lastOptions.params, {
add: true
});
store.load(lastOptions);
applyLoadMask(imagePanel.getEl().dom);

Based on my reading of the documentation, it appears that load({ add:true}) should append the new data. Am I reading it wrong?

Animal
5 Mar 2010, 5:43 AM
You're reading your own code wrong.

Into what object are you adding the property "add"?

fay
5 Mar 2010, 5:45 AM
Yeah, you've misread it. You don't apply add:true to the params but to lastOptions itself.


lastOptions = store.lastOptions;
Ext.apply(lastOptions, {
add: true
});
store.load(lastOptions);
Alternatively:


lastOptions.add = true;

Animal
5 Mar 2010, 5:46 AM
He'll starve before he learns to catch fish!