PDA

View Full Version : Store doesn't refresh totalCount after adding data



LizMyself
4 Feb 2015, 5:09 AM
Hey together,
I have a memorystore.
In the beginning everything is working fine.
If i add a record to the store by oStore.add(data), the paging doesn't get the new pagenumber. If i change the page, the new added record is lost.
after adding the record, the store does not change its totalCount, so the paging doesn't know, there is a new page.
If i use a pagingmemory Store nothing works anymore.
Has somebody an example for adding things to a memoryStore I can look at?
Thanks!
Here is the konfiguration of my store:


oStore = Ext.create('Ext.data.Store', { model: strModel,
success: function(strResult,oDataObject){
// only called when using proxy
Ext.log({level:'debug',dump:oDataObject},"createSelectedItemsStore create success"+strResult);
},
pageSize: nItemsPerPage,
proxy: {
type: 'memory',
enablePaging: true
},
listeners: {
load: {
fn: function(store,data){
// console.debug("createSelectedItemsStore listeners load",store,data);
}
}
},
data: aData
} );

joel.watson
6 Feb 2015, 9:28 AM
Hi--

The memory proxy paging is really meant for a static set of data. However, you can work around this by adding the new records directly to the proxy's data, and then reload the store. Or you could redefine the proxy altogether with the old+new data and then reset the store's proxy (and reload it).

I've included a Fiddle below that demonstrates the first option.

I hope that helps!
Thanks
Joel

hqv