PDA

View Full Version : How to access the store's data when store.buffered = true



wzl002
12 Jun 2012, 6:17 PM
I had a store and I want update it's data :

The correct code with buffered = false :


//buffered = false
var store = Ext.create('Ext.data.Store', {
fields: ...,
proxy: ...

});
store.load();

var records = store.data.items; // get All data

//... update records
// the update logic is so complex that I can't just use store.add, store.remove.

store.loadData(records); // reset All data




Now I want to use the "infinite scroll grid" so I set buffered = true.
then I find the code upside can't work, I find that the store cache data with 'pageMap', but there is no functions for the pageMap in the API.



var records = store.data.items; // just get part of the data
// ...

store.loadData(records); // update the data, BUT do not update the pageMap




So I wanna know when store.buffered = true :
1.How to get all data from a store?
2.How to reset all data to a store?


Thx.

yAdEs
12 Jun 2012, 7:00 PM
I have the same problem in directstore after 4.1, I need to get rawData without connect to server , but I can only get 50 records with buffered. I can't find others anywhere.

scottmartin
13 Jun 2012, 2:32 PM
Please review the following articles:
http://www.sencha.com/forum/showthread.php?185483-Grid-buffered-infinite-scrolling-in-4.1
http://www.sencha.com/blog/optimizing-ext-js-4-1-based-applications

It examples how buffering pages data.

Regards,
Scott.

wzl002
13 Jun 2012, 9:50 PM
I found the answer by view the src.



var recordsInStore = store.pageMap.getRange(0, pageSize); //get All Data


store.pageMap.addPage(1, recordsInStore);// set Data static
store.loadData(recordsInStore);// update the view