PDA

View Full Version : EXTJS Gridpanel not show data



hentobali
2 Mar 2010, 7:38 AM
I have used a Gridpanel in a Tabpanel, it doesn't show data, though the data are founded in firebug, why? I have checked many times, but still no solution... pls help me! :-/



--------------
myData=Ext.grid.dummyData=[];
myReader = new Ext.data.ArrayReader([{name: 'Kartentyp'},{name: 'Karte'},{name: 'Blattname'},{name: 'Bestellnummer'}]);

myStore = new Ext.data.GroupingStore({
reader:myReader,
data: myData,
autoDestroy: true,
sortInfo:{field: 'Kartentyp', direction: "ASC"},
groupField:'Karte' });

myGridPanel = new Ext.grid.GridPanel({
store: myStore,
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 200,
sortable: true},

columns: [
{header: "Karte", width: 60, sortable: true, dataIndex: 'Karte',hidden :true},
{header: "Blattname", width: 200, sortable: true, dataIndex: 'Blattname'},
{id:'Bestellnummer',header: "Bestellnummer", width: 200, sortable: true, dataIndex: 'Bestellnummer'},
{header: "Kartentyp", width: 40, sortable: true, dataIndex: 'Kartentyp',hidden :true}]}),

view: new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{text} ({[values.rs.length]}{[values.rs.length > 1 ? "Items" : "Item"]})'
}),
frame:true,
width: 400,
Height: 400,
autoScroll:true,
collapsible: true,
title: 'Anfrage Ergebnisse',
iconCls: 'icon-grid',
renderTo: 'result'
});

myData.push([kartentyp,karte,blattname,bestellnummer]);
myStore.loadData(myData);
myGridPanel.render(Ext.getDom('result'));

------------

Thanks!

Animal
2 Mar 2010, 7:40 AM
I assume that dummyData is not really [] in your code.

hentobali
2 Mar 2010, 7:45 AM
still not understand, in firebug could all data right be showed, that means the data are already be accessed, or?

Animal
2 Mar 2010, 7:50 AM
myData=Ext.grid.dummyData=[];
myReader = new Ext.data.ArrayReader([{name: 'Kartentyp'},{name: 'Karte'},{name: 'Blattname'},{name: 'Bestellnummer'}]);

myStore = new Ext.data.GroupingStore({
reader:myReader,
data: myData,
autoDestroy: true,
sortInfo:{field: 'Kartentyp', direction: "ASC"},
groupField:'Karte' });


You are loading an empty array.

hentobali
2 Mar 2010, 8:14 AM
thank you first!

but
myData=Ext.grid.dummyData=[]; // to initialize


then later

myData.push([kartentyp,karte,blattname,bestellnummer]);

myStore.loadData(myData);

I thought that the data can be later loaded, it's also our request, at begin in the tabpanel should other information be showed.
So must the data per event be loaded und dynamish showed.

Animal
2 Mar 2010, 8:57 AM
thank you first!

but
myData=Ext.grid.dummyData=[]; // to initialize


then later

myData.push([kartentyp,karte,blattname,bestellnummer]);

myStore.loadData(myData);

I thought that the data can be later loaded, it's also our request, at begin in the tabpanel should other information be showed.
So must the data per event be loaded und dynamish showed.

If the variables kartentyp, karte, blattname and bestellnummer are defined, that looks like it should work.

Animal
2 Mar 2010, 8:58 AM
Why are you rendering if you are using a TabPanel? Didn't you read the docs?

hentobali
2 Mar 2010, 9:25 AM
yes, the variables kartentyp, karte, blattname and bestellnummer are already defined.

we use drei tabs in one tabpanel, only in one tab will one Gridpanel be used, in other two not.

what have i wrong done?

Animal
2 Mar 2010, 12:52 PM
http://www.extjs.com/deploy/dev/docs/?class=Ext.Component&member=render