Hybrid View
-
9 Nov 2012 2:14 AM #1
Unanswered: Store.removeAll() and localStorage
Unanswered: Store.removeAll() and localStorage
Hello, i need to understand how the clearing method works, because after using store.removeAll(), the instance of my proxy seems to disappear in the localStorage of Chrome.
I load some patients associated with docs(which are a array of images), and a photo, i display these images in a list when i select a patient.
then i remove all my records , to setData from the record of a new patient.
This is working, but just once, after the removeAll(), the proxy used for my first patient is gone. so after switching again from my second to the first patient, my list is empty.
my StoreCode:loadingPatient: function(list, record) { this.getMain().push({ xtype:'patientdetail', title: record.get('CON_LASTNAME') +' '+record.get('CON_FIRSTNAME'), data : record.data }); var theStore=Ext.getStore('eventActe'); theStore.filterBy(function(rec){ return rec && rec.get('CON_ID') == record.get('CON_ID') }); theStore.load(); var form = this.getFichePat(); form.updateWithRecord(record); var imagStore=Ext.getStore('radios'); imagStore.removeAll(); imagStore.sync(); imagStore.setData(record.get('docs')); imagStore.load(); imagStore.sync(); var imgs = this.getTest(); imgs.refresh(); },
this is the record.get('docs');Code:Ext.define('CWFSE.store.ImagerieStore', { extend: 'Ext.data.Store', requires: ['CWFSE.model.Document'], config: { model: 'CWFSE.model.Document', storeId: 'radios', autoLoad: true, autoSync: true, proxy: { id : 'imagesProxy', type: 'localstorage', reader: { type: 'json', rootProperty:'files' } } } });
[Object, Object, Object, Object, Object, Object, Object, Object]
- 0: Object
- CON_ID: 1
- UPL_FILENAME: "png18B.png"
- UPL_ID: 3
- UPL_IP: "192.168.0.254"
- UPL_NAME: "radio1.png"
- UPL_PATH: "http://192.168.0.34/thumb/4036c36a16ef221529f77f2989f4dc57d1287d91/125/125"
- UPL_SIZE: "607000"
- UPL_TOKEN: "4036c36a16ef221529f77f2989f4dc57d1287d91"
- UPL_TYPE: "image/png"
- id: "1f0901d6-881b-43e3-b89f-de6ef668599d"
- patient_id: null
- xindex: 1
- 0: Object
-
10 Nov 2012 3:41 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
I'm not quite sure what you are asking about. Is it that you can only use removeAll once?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Nov 2012 12:01 AM #3
The pb is that once i use removeAll() or getProxy().clear() , i lost my proxy or a reference to the proxy in the ressources / local Storage.
I use a navigation view to display a list of users, and a carousel for the multiple views needed for details. the Selection made in the list loads data in the localstorage but so when i select a new user i add some data to the localstorage.
To avoid a memory pb i want to clear data from my proxy before adding the data from my new user, but using removeAll() destroy the ref or the object i'm using.
thanks for help
-
13 Nov 2012 10:22 AM #4
well i found a solution, but when i migrated to 2.1 the solution fail to work
Code:showDetail: function(list, record) { var imagStore=Ext.create('Ext.data.Store', { model: 'CWFSE.model.Document',// use a model data: record.get('docs'), // set the store data as the tasks array }); this.getTest().setStore(imagStore); }


Reply With Quote