PDA

View Full Version : GroupingStore and array



silenteffect
6 Jul 2009, 1:00 AM
hi!
First of all, sorry for my english...:">

I have a mixed array:


var myData = [];
for (i=0 ; i<righe ; i++){
myData[i]=[nome_str[i],grup[i],z[i],df[i],dt[i],hf[i],hss[i],hsi[i],khkv[i]]//they come from a pg_query in php
}Then I would put this array in a GroupingStore, but it doesn't work...

I tried:


var store = new Ext.data.SimpleStore({
fields: [
{name: 'nome'},
{name: 'grup'},
{name: 'z', type: 'float'},
{name: 'df', type: 'float'},
{name: 'dt', type: 'float'},
{name: 'hf', type: 'float'},
{name: 'hss', type: 'float'},
{name: 'hsi', type: 'float'},
{name: 'khkv', type: 'float'}
]
});
store.loadData(myData);
And it works =D>.

Then I tried the same, but:


......
var store = new Ext.data.GroupingStore .........
.......
And it doesn't work.
So I tried:



var store = new Ext.data.GroupingStore({
reader:reader,
sortInfo:{field: 'nome', direction: "ASC"},
groupField:'grup'
});

var reader = new Ext.data.ArrayReader({}, [
{name: 'nome'},
{name: 'grup'},
{name: 'z', type: 'float'},
{name: 'df', type: 'float'},
{name: 'dt', type: 'float'},
{name: 'hf', type: 'float'},
{name: 'hss', type: 'float'},
{name: 'hsi', type: 'float'},
{name: 'khkv', type: 'float'}
]);

store.loadData(myData);
and


var store = new Ext.data.GroupingStore({
reader:reader,
data:myData;
sortInfo:{field: 'nome', direction: "ASC"},
groupField:'grup'
});

var reader = new Ext.data.ArrayReader({}, [
{name: 'nome'},
{name: 'grup'},
{name: 'z', type: 'float'},
{name: 'df', type: 'float'},
{name: 'dt', type: 'float'},
{name: 'hf', type: 'float'},
{name: 'hss', type: 'float'},
{name: 'hsi', type: 'float'},
{name: 'khkv', type: 'float'}
]);

But the result was the same: nothing....:((

Please help me....

Ahhh,

all of this are for:

var grid = new Ext.grid.GridPanel({
store: store,..........

Condor
6 Jul 2009, 4:59 AM
Both examples should work if you defined the reader BEFORE the store!

silenteffect
6 Jul 2009, 5:08 AM
Ops..:D
Thanks