PDA

View Full Version : how to prevent Extjs Store caching the data ?



raminbp
21 May 2013, 4:57 AM
Hi

it seems that store caches the data by default . i have some records in it , and when i call load method on it , i expect that it throw away old records , and replace the new Data , but it doesn't .
i have set noChache config to true, and it acts still the same .
anyway i added a listener for 'beforeload' event to clear the store , but i'm sure there is a simple config to do the job .

Thanks

friend
21 May 2013, 5:28 AM
Can you please post a concise code sample which illustrates how your store is constructed?

Thanks.

raminbp
21 May 2013, 8:22 AM
it's an ordinary Store

Ext.define('GamCalendar.calendar.store.EventVtoStore',{
extend: 'Ext.data.Store',
alias: 'store.eventvtostore',


storeId: 'eventvtostore',
autoLoad: false,
requires: [
'GamCalendar.calendar.model.eventVto.EventVtoModel'
],
model: 'GamCalendar.calendar.model.eventVto.EventVtoModel',
proxy: {
type: 'ajax',
api: {
read:'extJsController/eventList/fetchInterval'
},
noCache: true,
reader: {
type: 'json',
root: 'records'
},
limitParam: undefined,
pageParam: undefined,
startParam: undefined
}
});

friend
21 May 2013, 8:42 AM
I don't see anything obviously wrong with your store config. The only slight oddity I see is that you're setting some of the default params to 'undefined', where I assume you're just trying to suppress them.

When you reload the store, is it duplicating data, e.g. each time you reload the store it adds more and more data? Or is it that changes are being made to the data server-side and you're not seeing these updates on each reload of the store?

raminbp
21 May 2013, 9:21 AM
no , it doesn't duplicate. assume that you have some records in every time interval you passed to the server.
each time you load some events in that interval. the events add up in store, which i don't want that to happen.
store is getting bigger and bigger.