-
6 Oct 2010 2:17 AM #1
Doubt about JsonStore
Doubt about JsonStore
Hello!
I've got a doubt about JsonStore. Is there any way to keep data in the store after load? I need to operate with the store but after load, the information seems to be disappeared
.
What am i doing wrong? Am i loosing any config. option?
Thanks in advance!People won't be people when they hear this sound, that's been glowing in the dark, at the edge of town. People won't be people, no, the people won't be people when they hear this sound. Won't you show me what begins at the edge of town. The singer is a crook Woah-ay-oh! The kitchen is the cook Woah-ay-oh! The scissors are the barbers Woah-ay-oh! The singer is a crook Woah-ay-oh! The chorus, full of actors Woah-ay-oh! The chorus doesn't matter!
-
6 Oct 2010 2:28 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Load is asynchronous! You have to wait for the server to respond before you can access the data.
You can do that by using a load event handler or the load method callback.
-
6 Oct 2010 2:34 AM #3
Uhm... I know that, but i'd like to keep data in the store after load event... I can access to data 1 minute after maybe...
Thanks Condor!People won't be people when they hear this sound, that's been glowing in the dark, at the edge of town. People won't be people, no, the people won't be people when they hear this sound. Won't you show me what begins at the edge of town. The singer is a crook Woah-ay-oh! The kitchen is the cook Woah-ay-oh! The scissors are the barbers Woah-ay-oh! The singer is a crook Woah-ay-oh! The chorus, full of actors Woah-ay-oh! The chorus doesn't matter!
-
6 Oct 2010 2:39 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Data in a store doesn't magically disappear. Are you sure you are not clearing the store?
Maybe you should post some code of what you are actually trying to do...
-
6 Oct 2010 3:01 AM #5
Ok
.
This is the situation (a little bit complicated!):
i've got a TabPanel with some items (a ComboBox and TextFields and Store) and an EditorGridPanel with data. Depending on the rows of the EditorGridPanel, the panel's store changes.
When i load the window i load the store. onLoad, i can see items in the store, but afterload, store seems to be empty.
This is the code:
Combo's store is the same than JsonStore of the TabPanel. When i try to get info from the console, store is empty (after load).Code:var tabPanelFianzas = Ext.extend(Ext.TabPanel,{ onRender: function() { tabPanelFianzas.superclass.onRender.apply(this, arguments); }, height: 140, activeTab: 0, radio: null, frame: true, border: false, cargarFianza: function(empresa){ if(obj.getCount() > '0'){ this.setCampos(empresa); }else{ var fianza = this.store.recordType; var f = new fianza({ idFianza: null, empresa: '', importeFP: null, fechaSolicitudFP: null, bancoFP: null, polizaFP: null }); this.store.insert(this.store.getCount(), f); } }, addCampo: function(campo, valor){ var i=this.store.find('empresa',Ext.getCmp('comboFianzas').getValue()); var record = this.store.getAt(i); record.set(campo,valor); }, setCampos: function(empresa){ var i=this.store.find('empresa',empresa); Ext.getCmp('importeFP').setValue(this.store.getAt(i).data.importeFP); Ext.getCmp('fechaSolicitudFP').setValue(this.store.getAt(i).data.fechaSolicitudFP); Ext.getCmp('bancoFP').setValue(this.store.getAt(i).data.bancoFP); Ext.getCmp('polizaFP').setValue(this.store.getAt(i).data.polizaFP); Ext.getCmp('fechaFianza').setValue(this.store.getAt(i).data.fechaFianza); Ext.getCmp('checkFianza').setValue(this.store.getAt(i).data.checkFianza); }, store: new Ext.data.JsonStore({ url: '../napp/Fianzas/get-fianzas-oferta', root: 'filas', autoLoad: true, totalProperty: 'total', fields: ['idFianza','empresa','importeFP', 'fechaSolicitudFP', 'bancoFP', 'polizaFP', 'fechaFianza', 'checkFianza'], listeners: { load: function(obj){ console.log(obj); // If i do it here, i see data. if(obj.getCount() > 0){ Ext.getCmp('importeFP').setValue(obj.getAt(0).data.importeFP); Ext.getCmp('fechaSolicitudFP').setValue(obj.getAt(0).data.fechaSolicitudFP); Ext.getCmp('bancoFP').setValue(obj.getAt(0).data.bancoFP); Ext.getCmp('polizaFP').setValue(obj.getAt(0).data.polizaFP); Ext.getCmp('fechaFianza').setValue(obj.getAt(0).data.fechaFianza); Ext.getCmp('checkFianza').setValue(obj.getAt(0).data.checkFianza); } } } }), initComponent: function () { Ext.apply(this, { items:[{ title: 'Sumario Fianzas', frame: true },{ title: 'Añadir Fianza', frame: true, layout: 'form', items:[{ xtype: 'combo', store: this.store, id: 'comboFianzas', displayField: 'empresa', fieldLabel: 'Empresa', mode: 'local', triggerAction: 'all', anchor: '30%', listeners:{ select: function(){ this.setCampos(Ext.getCmp('comboFianzas').getValue()); }, scope: this } },{ ... ITEMS ... }] }] }); tabPanelFianzas.superclass.initComponent.apply(this, arguments); } }); Ext.reg('tabPanelFianzas', tabPanelFianzas);
Thanks!People won't be people when they hear this sound, that's been glowing in the dark, at the edge of town. People won't be people, no, the people won't be people when they hear this sound. Won't you show me what begins at the edge of town. The singer is a crook Woah-ay-oh! The kitchen is the cook Woah-ay-oh! The scissors are the barbers Woah-ay-oh! The singer is a crook Woah-ay-oh! The chorus, full of actors Woah-ay-oh! The chorus doesn't matter!
-
6 Oct 2010 3:49 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
What exactly are you entering on the console?
-
6 Oct 2010 3:59 AM #7
-
6 Oct 2010 4:14 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
So you are doing something like:
Code:console.log(Ext.getCmp('comboFianzas').store.getCount());
-
6 Oct 2010 5:42 AM #9
Yes, i watched that screencast
. I'm trying to avoid the use of Ext.getCmp. Anyway, that's just a test
.
Yes, i write something like that. But, i'm really sorry because (i don't know why) it works rightnow... Thanks for your help
.People won't be people when they hear this sound, that's been glowing in the dark, at the edge of town. People won't be people, no, the people won't be people when they hear this sound. Won't you show me what begins at the edge of town. The singer is a crook Woah-ay-oh! The kitchen is the cook Woah-ay-oh! The scissors are the barbers Woah-ay-oh! The singer is a crook Woah-ay-oh! The chorus, full of actors Woah-ay-oh! The chorus doesn't matter!
Similar Threads
-
Doubt on Rowexpander
By ssssuresh2007 in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 11 Jun 2010, 3:44 AM -
Doubt in the ExtJs
By phanikumar121 in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 3 Mar 2010, 7:24 AM -
Doubt about license
By Zener in forum Community DiscussionReplies: 8Last Post: 14 Feb 2009, 4:15 PM


Reply With Quote