PDA

View Full Version : problem for extending JsonStore



b3f3
14 Nov 2010, 4:58 PM
Hello,
I've a gridPanel and a Jsonstore -> All is ok, data shows.
When I want to use an extend of JsonStore, data don't show in the grid and firebug don't return me error.
Firebug return correctly the json array in console.

Here is the code for the store :


App.data.ordersJsonStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(config) {
Ext.apply(this, {
// pre-configured options
id: 'gridStore'
,sortInfo: {field: 'cmd_id', direction: 'DESC'}
,url: 'public/php/ordersGridFilter.php'
,root: 'data'
,totalProperty: 'total'
,remoteSort: true
,fields: [
{name: 'cmd_id', type:'int'}
,{name: 'cmd_patient', type:'string'}
,{name: 'cmd_date_commande', type:'date'}
,{name: 'etc_pub_nom', type:'string'}
,{name: 'etc_pub_id', type:'int'}
,{name: 'cmd_montant', type:'float'}
]
});
App.data.ordersJsonStore.superclass.constructor.apply(this, arguments);
}
});

Ext.ComponentMgr.register('orderjsonstore', App.data.ordersJsonStore);

ordersStore = new App.data.ordersJsonStore();

ordersStore.load({params:{start: 0, limit: 20}});


ordersGridPanel = new Ext.grid.GridPanel({
[...]
store: ordersStore,
[...]Can you help me ?
Thanks

b3f3
15 Nov 2010, 10:12 PM
no idea ?

laurentParis
16 Nov 2010, 1:23 AM
App.data.OrdersJsonStore = Ext.extend(Ext.data.JsonStore, {
constructor: function (config) {
Ext.applyIf(config, {
// pre-configured options
id: 'gridStore',
sortInfo: {
field: 'cmd_id',
direction: 'DESC'
},
url: 'public/php/ordersGridFilter.php',
root: 'data',
totalProperty: 'total',
remoteSort: true,
fields: [{
name: 'cmd_id',
type: 'int'
},
{
name: 'cmd_patient',
type: 'string'
},
{
name: 'cmd_date_commande',
type: 'date'
},
{
name: 'etc_pub_nom',
type: 'string'
},
{
name: 'etc_pub_id',
type: 'int'
},
{
name: 'cmd_montant',
type: 'float'
}]
});
App.data.OrdersJsonStore.superclass.constructor.call(this, config);
}
});

Ext.ComponentMgr.register('orderjsonstore', App.data.OrdersJsonStore);

ordersStore = new App.data.OrdersJsonStore();

ordersStore.load({
params: {
start: 0,
limit: 20
}
});


ordersGridPanel = new Ext.grid.GridPanel({
[...]
store: ordersStore,
[...]

b3f3
16 Nov 2010, 1:42 AM
Thank you,
I'll try this later and I will come back to tell if it worked.