Hi,
What can be happening if my store is loaded but empty??
In firebug I see the reader has the response loaded ok.
Json is also fine as I've checked on JSLint.
Anyone??![]()
Hi,
What can be happening if my store is loaded but empty??
In firebug I see the reader has the response loaded ok.
Json is also fine as I've checked on JSLint.
Anyone??![]()
the json may pas jslint, but that doesnt mean it matches what the reader expects.
and you havent given us enough information to help with that.
Thanks Devnull,
this is the code for my Store:
The Json response I get is this:Code:var reader = new Ext.data.JsonReader({}, [ {name: 'Articulo', type: 'string', mapping: 'label'}, {name: 'Descripcion', type: 'string', mapping: 'descripcion'}, {name: 'Categoria', type: 'string', mapping: 'categoria'}, {name: 'Subpartida', type: 'string', mapping: 'subpartida'}, {name: 'Unidad', type: 'string', mapping: 'unidad'}, {name: 'Cantidad', type: 'string', mapping: 'cantidad'}, {name: 'Ultima_mod', type:'date', mapping: 'ult_mod', dateFormat: 'Y-m-d H:i:s'} ]); // create the data store var resultStore = new Ext.data.GroupingStore({ url: 'index.php', totalProperty: 'totalRecords', root: 'resultadoGrid', reader: reader, sortInfo:{field: 'Articulo', direction: "ASC"}, remoteSort: true });
({"totalRecords":4,"resultadoGrid":[{"cuenta_art":"1","recordID":"13","label":"Articulo 001","descripcion":"Articulo de pruebas","cod_categoria":"2","categoria":"MC-Mercadera","subpartida":"12.69.51.23.51","unidad":"500 PIEZAS(PZA),60 TONELADAS(TM),40000 PIES(FT)","cantidad":"500,60,40000","ult_mod":"2008-06-19 15:14:03"},{"cuenta_art":"1","recordID":"14","label":"Articulo 002","descripcion":"Aceites para elaboracion de resinas industriales","cod_categoria":"2","categoria":"MC-Mercadera","subpartida":"12.69.48.72.13","unidad":"150 BARRILES (42 GALON US)(BRR ),300000 LITRO (L ),8000000 ONZAS (OZ )","cantidad":"150,300000,8000000","ult_mod":"2008-06-19 15:14:03"},{"cuenta_art":"1","recordID":"15","label":"Aceite Crudo de Palma","descripcion":"","cod_categoria":"1","categoria":"MP-Materia prima","subpartida":"12.69.48.72.13","unidad":"2000 TONELADAS(TM),2000000 KILOGRAMO(KG)","cantidad":"2000,2000000","ult_mod":"2008-06-19 15:13:52"},{"cuenta_art":"1","recordID":"16","label":"Montacargas","descripcion":"Montacargas utilizado en el proceso de produccion","cod_categoria":"3","categoria":"MQ-Maquinaria","subpartida":"12.69.48.72.13","unidad":"1 UNIDADES(U)","cantidad":"1","ult_mod":"2008-06-19 14:51:43"}]})
You are not configuring your JsonReader properly. It needs the totalProperty and root.
http://extjs.com/deploy/dev/docs/?cl...ata.JsonReader
ohhh, I see, so the totalProperty and root have to go on Reader but not in Store as I had??
One thing though, I can see the store is loading twice
I make my store load on a listener from a combo and, on store 'load' listener, I make my grid render and the store loads again.
Is this ok?
Thanks Animal as usual![]()
the reader doesn't 'load', it acts as a 'filter' to parse data and properly fill the 'slots' for the records that go into the data store.
https://moduscreate.com/wp-content/t...es/favicon.png
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
Yes, jgarcia.
Is the data store what I'm talking about.
Maybe with the code is better understood:
Code:mycombo.on('select', function(us){ win_Choose_Cliente.hide(); resultStore.proxy= new Ext.data.HttpProxy({url: 'index.php?accion=consultarAdmSaldoInventarios&opcionExt=cargaGrid&dpCliente='+this.value}); resultStore.load({params: {start:0, limit: 2}}); }); //this loads my store correctlly :) //now here's the listener for the loading of the store where I render my grid resultStore.on({ 'load':{ fn: function(store, records, options){ grid.render('menuActions'); grid.getSelectionModel().selectFirstRow(); //this is for checking on firebug console.log('Data Store listener fired (load), arguments:',arguments); console.log('Store count = ',store.getCount()); } ,scope:this } });
Never mind
I solved the problem not loading the store but directlly rendering the grid on the combo select event![]()
Are you sure about that?
Do you really want to re-render the grid every time the combo selection changes?
"be dom-ready..."
Doug Hendricks
Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.
Got Sencha licensing questions? Find out more here.
seems like a waste to me.
https://moduscreate.com/wp-content/t...es/favicon.png
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training