-
21 May 2010 2:08 PM #1
Desktop - load JSON data into grid
Desktop - load JSON data into grid
Hello,
I'm trying to edit web desktop example.
I want to display standard Desktop grid, but i want to display external data. I tried to modyfy this code:
but my changes make desktop only with background and icons. I want to load JSON data from external file. Not from local Array (ext.grid.dummydata). Do you have any ideas?Code:ds: new Ext.data.Store({ reader: new Ext.data.ArrayReader({}, [ {name: 'surname'}, {name: 'name'}, {name: 'age', type:'number'}, {name: 'lastVisit', type:'date', dateFormat: 'Y-m-d H:i'} ]), data: Ext.grid.dummyData }),
-
21 May 2010 10:51 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Have a look at the grid examples (you need to configure a store proxy for your remote data location).
-
22 May 2010 4:53 AM #3
I tried this code:
but it doesn't work. Can someone fix my mistakes?Code:ds: new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url: 'json.php'}), reader: new Ext.data.JsonReader({ totalProperty: 'total', successProperty: 'success', root: 'database', messageProperty: 'message' }, [ {name: 'surname'}, {name: 'name'}, {name: 'age'}, {name: 'lastVisit', type:'date', dateFormat: 'Y-m-d H:i'} ]) }),
-
22 May 2010 5:13 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Are you loading the store (use autoLoad:true if you don't)?
ps. Does json.php match the reader as you defined it?
-
22 May 2010 5:15 AM #5
What does json.php return?
Did you configure the grid's columns correctly?
-
22 May 2010 6:41 AM #6
Is autoLoad corectly implemented?
json.php returns:Code:ds: new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url: 'json.php'}), reader: new Ext.data.JsonReader({ totalProperty: 'total', successProperty: 'success', root: 'database', messageProperty: 'message' }, [ {name: 'surname'}, {name: 'name'}, {name: 'age'}, {name: 'lastVisit', type:'date', dateFormat: 'Y-m-d H:i'} ]), autoLoad:true }),
Code:{'database':[{'surname':'Wójtowicz','name':'Michał','age':19,'lastVisit':'2010-01-01 12:00'}]}
-
22 May 2010 7:27 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Correct (although you should remove totalProperty, successProperty and messageProperty).
If you still don't see anything, then you have to debug (use the Firebug Net tab to see if the server request and response are correct).
-
23 May 2010 11:09 AM #8
Similar Threads
-
Load JSON data into a Grid
By abcdef in forum Ext 3.x: Help & DiscussionReplies: 13Last Post: 3 Apr 2010, 11:12 AM -
how can i load data from json to grid
By anoop abbot in forum Ext 2.x: Help & DiscussionReplies: 6Last Post: 16 Apr 2009, 1:17 AM -
Load returned json data into a grid.
By whdanj in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 15 Apr 2009, 5:26 AM -
Steps to load JSON/XML data into a Grid?
By jpnet in forum Community DiscussionReplies: 1Last Post: 11 Dec 2008, 8:02 AM -
load data then desktop
By Matt2012 in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 31 Oct 2007, 4:09 AM


Reply With Quote