-
1 Sep 2012 8:37 PM #1Sencha Premium Member
- Join Date
- Apr 2012
- Location
- Mumbai, India
- Posts
- 191
- Vote Rating
- -1
- Answers
- 10
Answered: ExtJs 4.1 - Uncaught Error - Cannot read property "items" of undefined.
Answered: ExtJs 4.1 - Uncaught Error - Cannot read property "items" of undefined.
Folks,
I am trying to bring a Json and bind it with the gridpanel in ExtJS 4.1.
I've checked that it's a valid Json returned. But it's not getting bind with gridpanel.
Also, it is showing me one error on console.
error.jpg
Here's my code :-
app.js:-
Here's my json returned :-Code:var record = Ext.data.Record.create([ {name: 'id'}, { name: 'name', type: 'string' }, { name: 'title', type: 'string' }, { name: 'content', type: 'string' } ]); var reader = new Ext.data.reader.Json({ root: 'data', totalProperty: 'total', successProperty: 'success' }, record); var writer = new Ext.data.writer.Json({ encode: true, writeAllFields: true }); var store = new Ext.data.JsonStore({ proxy: proxy, reader: reader, writer: writer, fields: ['id','content','name','title'], autoSave: false }); .... ... items: [ { xtype: 'gridpanel', columns: [ { text: 'Name', dataIndex: 'name' }, { text: 'Title', dataIndex: 'title' }, { text: 'Content', dataIndex: 'content', flex: 1 } ], store: store } ]
Code:{ "data": [ { "name": "Person1", "id": 1, "content": "Hello World", "title": "First App" }, { "name": "Person2", "id": 2, "content": "Great ExtJS Application", "title": "ExtJS" }, { "name": "Person3", "id": 3, "content": "Best HTML5 framework", "title": "Sencha Touch" } ], "total": 3, "success": true }
--
Bomslang,
Software Engineer,
HTML5 Developer | ExtJS, Sencha Touch, GXT Passionate | Json Supporter
Twitter : @bomslang
----------------------------------------------------------------------------------
# Learn about Sencha Products via it's Documentation : ExtJS | Sencha Touch | GXT
# Check for correct Json here : JSONLint.com
# Want to code Sencha Touch Online ? Try SenchaFiddle.com
# Want to code and test ExtJS Online ? Try http://ext4all.com/ & http://jsfiddle.net/
# Must Read : 20 things to avoid / do when starting with ExtJS or Sencha Touch
-
Best Answer Posted by bomslang
I guess, this example runs according to ExtJS 3.0 documentation.
I got it working by checking appropriate syntax'es for similar components in ExtJS 4.1.
Thanks
-
1 Sep 2012 9:31 PM #2Sencha Premium Member
- Join Date
- Apr 2012
- Location
- Mumbai, India
- Posts
- 191
- Vote Rating
- -1
- Answers
- 10
I guess, this example runs according to ExtJS 3.0 documentation.
I got it working by checking appropriate syntax'es for similar components in ExtJS 4.1.
Thanks--
Bomslang,
Software Engineer,
HTML5 Developer | ExtJS, Sencha Touch, GXT Passionate | Json Supporter
Twitter : @bomslang
----------------------------------------------------------------------------------
# Learn about Sencha Products via it's Documentation : ExtJS | Sencha Touch | GXT
# Check for correct Json here : JSONLint.com
# Want to code Sencha Touch Online ? Try SenchaFiddle.com
# Want to code and test ExtJS Online ? Try http://ext4all.com/ & http://jsfiddle.net/
# Must Read : 20 things to avoid / do when starting with ExtJS or Sencha Touch


Reply With Quote