-
1 Sep 2009 6:23 AM #1
DirectStore and GridPanel -> I have to pay for the new version
DirectStore and GridPanel -> I have to pay for the new version
Hello,
I spent a night try to fill a grid !
In 5 minutes, I 'm able to have this to the client side (thanks to the ext-direct-pack) :
But impossible to fill the grid :Code:{"type":"rpc","result":{"classified": {"status":null,"name":"a","updated_at":"2009-04-29T11:21:48Z","display_address":null,"abstract":"a","estate_id":"1","end_announcement":null,"contact":null,"id":1,"owner_id":"1","start_announcement":null,"created_at":"2009-04-29T11:21:48Z"}},"status":true,"errors":[],"message":"Classifieds#index","tid":2}
I try all the examples, lots of threads and Google but impossible to find what's wrong.Code:var store = new Ext.data.DirectStore({ directFn: Classifieds.direct, // this function work ! paramsAsHash: false, root: '', idProperty: 'id', fields: ['id', 'name'] }); var userColumns = [ {header: 'name', width: 160, sortable: true, dataIndex: 'name'}, {id: 'id', header: 'id', width: 160, sortable: true, dataIndex: 'id'} ]; var userGrid = new Ext.grid.GridPanel({ renderTo: 'user-grid', title: 'Users', autoScroll: true, height: 300, store: store, columns : userColumns }); store.load();
Someone can help me with this ? Thanks a lot for your help.
-
1 Sep 2009 8:22 AM #2
1) Your root is empty.
2) The idProperty doesn't match anything your data has returned.
3) The id field you've specified don't match anything your data has returned.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
2 Sep 2009 2:11 AM #3
Thanks a lot for your help. However I already test the grid with :
And in my data, there is and id field (not in first position).Code:root: 'classified'
-
2 Sep 2009 5:11 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
The root isn't 'classified'. It's 'result.classified', which is a lot better to see if you format the JSON data:
Code:{ "type": "rpc", "result": { "classified": { "status": null, "name": "a", "updated_at": "2009-04-29T11:21:48Z", "display_address": null, "abstract": "a", "estate_id": "1", "end_announcement": null, "contact": null, "id": 1, "owner_id": "1", "start_announcement": null, "created_at": "2009-04-29T11:21:48Z" } }, "status": true, "errors": [], "message": "Classifieds#index", "tid": 2 }
-
2 Sep 2009 5:47 AM #5
Thanks Condor. sorry for this huge mistake. I changed the root but the result is the same : the grid is empty.
My code :
Code:var store = new Ext.data.DirectStore({ directFn: Classifieds.direct, paramsAsHash: false, root: 'result.classified', fields: ['name'] }); var userColumns = [ {header: 'name', width: 160, sortable: true, dataIndex: 'name'}, ]; var userGrid = new Ext.grid.GridPanel({ renderTo: 'user-grid', title: 'Users', autoScroll: true, height: 300, store: store, columns : userColumns }); store.load();
-
2 Sep 2009 6:09 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Which Ext version are you using? For older Ext versions the root needs to be an array, e.g.
Code:{ "type": "rpc", "result": { "classified": [{ "status": null, "name": "a", "updated_at": "2009-04-29T11:21:48Z", "display_address": null, "abstract": "a", "estate_id": "1", "end_announcement": null, "contact": null, "id": 1, "owner_id": "1", "start_announcement": null, "created_at": "2009-04-29T11:21:48Z" }] }, "status": true, "errors": [], "message": "Classifieds#index", "tid": 2 }
-
2 Sep 2009 6:19 AM #7
-
2 Sep 2009 6:33 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
3.0 isn't a version. The latest version is 3.0.1 and I assume you are using 3.0.0?
-
2 Sep 2009 6:43 AM #9
-
2 Sep 2009 6:49 AM #10Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
In that case you'll need to convert your JSON data into an array (or upgrade to 3.0.1).


Reply With Quote