PDA

View Full Version : this.ds is undefined



Stephan123
24 Sep 2009, 6:29 AM
Hello !

I have build a simple window.
In this window is a Gridpanel.
When i start the app i becam an error message.

'this.ds is undefined'

The callback from the server is

{success: true, anzahl: 3, results: [{"name":"aaa","vorname":"111"},{"name":"bbb","vorname":"222"},{"name"
:"ccc","vorname":"333"}]}

Here the code:

var fenster = new Ext.Window({
width: 500,
height: 500,
title: 'Fenster',
id: 'fenster',
tbar: {
height: 20
},
bbar: {
height: 20
},
renderTo: document.body,
items: [{
xtype: 'panel',
id: 'abschnitt1',
title: 'Abschnitt 1',
height: 400
}],

macheInhalt: new Ext.grid.GridPanel({
title: 'Personen',
width: 400,
height: 400,
id: 'tabelle',
store: this.erstelleSpeicher,
columns: [{
header: 'Name'
},{
header: 'Vorname'
}]
}),

erstelleSpeicher: new Ext.data.JsonStore({
totalProperty: 'anzahl',
root: 'results',
url: 'layout9.php',
id: 'speicher',
baseParams: {
modul: 'personenmodul',
aktion: 'auflisten'
},
fields: [{
name: 'name'
},{
name: 'vorname'
}]
}),

fuelleInhalt: function(){
this.erstelleSpeicher.load();
Ext.getCmp('abschnitt1').add(this.macheInhalt);
}

});

fenster.fuelleInhalt();
fenster.show();

How can help ?

Your sincerly

Stephan

Stephan123
25 Sep 2009, 1:02 AM
Hello !

I have found the buggy =P~ !

The new method 'fuelleInhalt' is



fuelleInhalt: function(){
this.erstelleSpeicher.load();
this.macheInhalt.store = this.erstelleSpeicher;
Ext.getCmp('abschnitt1').add(this.macheInhalt);
}


In the first line is call the response from the server.
In the second line the grid becam the server response.
In the third line the grid is insert in the window.

Take a look at image.

Your sincerly

Stephan