PDA

View Full Version : Delete Store



eraflame
24 Apr 2012, 10:39 PM
Hi all! Sorry for my English.
I have a trouble when i try to delete a store.


for(var i=0;i<answer.length;i++){
work_ids.push(answer[i]['id']);
inner_text = JSON.parse(answer[i]['inner_data']);
Ext.create('Ext.data.Store',{
model: 'innerModel',
storeId: 'nestedStore-'+answer[i]['id']
});
Ext.data.StoreManager.lookup('nestedStore-'+answer[i]['id']).loadData(inner_text);
......
}

Then, i try to work with this store in FireBug console like this:


Ext.data.storeManager.lookup('nestedStore-147');

return an object: Object {events=Object, data=Object, groupers=Object, ...}


Ext.data.storeManager.lookup('nestedStore-147').destroy()

return an error: TypeError: Cannot call method 'indexOf' of undefined
I try use "delete Ext.data.storeManager.lookup('nestedStore-147')" - this return "true" but do not delete object. Please help me - how to delete a store? :-/

vietits
24 Apr 2012, 10:46 PM
To destroy a store, you should use <store>.destroyStore() not <store>.destroy(). The later is used to delete a record from store.

eraflame
24 Apr 2012, 11:16 PM
Thanks vietits! It works!