PDA

View Full Version : Empty Datagrid Cells, But Correct Pagination



Andrew Peacock
5 May 2010, 6:29 AM
Hi all,

I'm delving into EXTJS for the first time, and have hit a snag with the datagrid. It's rendering OK, data is being returned from the host script, and the pagination is fine - 5 pages of 20 rows each. But... every cell is empty!

Can anyone help me debug this please?

I've set it up live, rather than posting code:

The sample page is here (this is a sub-set of the full app I'm working on, to weed out the other stuff that's working fine): http://resource-directory.info/extjsdatagrid/

The store is being created here: http://resource-directory.info/extjsdatagrid/data.js


var reader = new Ext.data.JsonReader({
id:'id',
idProperty: 'id',
totalProperty: 'count',
successProperty: 'success',
fields: [
'id',
'title',
'director',
{name: 'released', type: 'date', dateFormat: 'Y-m-d'},
'genre',
'tagline',
'price',
'available'
]
});

var store = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'data.php'
}),
reader: reader,
autoLoad: true,


});(the live sample includes some event capturing to log to firebug's console)

The JSON results from the PHP page check out OK on jslint.com, and as mentioned, pagination is OK, so the store/grid are reading the total recordcount and the number of rows in this page OK, and the number of pages checks out OK as well, so the callback is working OK.

But no data on-screen! Aaarrrrgh!

Any help would be GREATLY appreciated,

Regards,
Andy

Andrew Peacock
5 May 2010, 6:55 AM
And I've got it working!

The reader now starts:


var reader = new Ext.data.JsonReader({
root:'rows',
idProperty: 'id',
totalProperty: 'count',.....

Although I missed the 'root' out, I had it in before and was getting no data.

Wierd!

Andy