PDA

View Full Version : Grid not load



Stephan123
8 Apr 2011, 7:30 AM
Hello !

I can't find the bug. I missing the items. :s


var jsonStore;
var grid;

Ext.QuickTips.init();

// reference local blank image
Ext.BLANK_IMAGE_URL = '/extjs/lib/resources/images/default/s.gif';

Ext.onReady(function(){
jsonStore = new Ext.data.JsonStore({
totalProperty: 'anzahl',
root: 'data',
url: 'grid.php',
id: 'jsonStore',
fields: ['FaId','progname','eintrittspreise']
});

// create the Grid
grid = new Ext.grid.GridPanel({
store: jsonStore,
columns: [
{
id :'FaId',
header : 'Programmnummer',
width : 100,
dataIndex: 'FaId'
},
{
header : 'Programmbezeichnung',
width : 200,
dataIndex: 'progname'
},
{
header : 'Eintrittspreise',
width : 200,
dataIndex: 'eintrittspreise'
}],
height: 350,
width: 600,
title: 'Zusatzartikel'
});

// render the grid to the specified div in the page
grid.render('grid');
jsonStore.load();
});


and here the answer from my php file


echo "{success: true, data: ".json_encode($ausgabe).", anzahl: 20}";

Where is the bug ?


Your sincerly

Stephan

fay
8 Apr 2011, 8:13 AM
I can't see anything immediately wrong with it, can you post your php's response, i.e., the full JSON? (You can get this if you use Firefox + Firebug).

Just one thing, do you need to have jsonStore and grid global? I'd put them (and the QuickTips.init) within the onReady:



var jsonStore = ...

var grid = ...

drian
8 Apr 2011, 8:16 AM
all your code should be under Ext.onReady function