-
21 Sep 2011 9:10 AM #1
XML Reader into a grid
XML Reader into a grid
Hi,
I'm using the my code from v3:
But when I run Firebug I recive an error:PHP Code:var store = new Ext.data.Store({
url: 'data/worksample.xml',
reader: new Ext.data.XmlReader({
record: 'record',
id: 'id'
}, [
'id', 'service', 'actualprogress', 'plannedprogress', 'completiondate'
])
});
me.model is undefined
Any ideas?
-
21 Sep 2011 9:17 AM #2
You have to define model first :
Then add one property in your store :Code:Ext.define('myModel',{ extend: 'Ext.data.Model', fields: [ 'f1','f2'] });
OR --- you can simply define fields in your store before reader.Code:model:myModel,
Give a tryCode:url : ...., fields : [ 'f1','f2'], reader : .....

-
21 Sep 2011 9:32 AM #3
hellosatya thanks for replying,
I'm really confused I thought it was easier in v3, so I need to do this:
PHP Code:Ext.define('myModel',{
extend: 'Ext.data.Model',
url: 'data/worksample.xml',
reader: new Ext.data.XmlReader({
record: 'record',
id: 'id'
}, [
'id', 'service', 'actualprogress', 'plannedprogress', 'completiondate'
])
});
Then how do set this to my grid?
it was:
PHP Code:var grid = Ext.create('Ext.grid.Panel', {
store: store,
.......
-
21 Sep 2011 2:20 PM #4
Try this :
Code:var store = new Ext.data.Store({ url: 'data/worksample.xml', fields:[ 'id','service','actualprogress','plannedprogress','completiondate' ], reader: new Ext.data.XmlReader({ record: 'record', id: 'id' }) });
-
22 Sep 2011 12:21 PM #5
thanks hellosatya,
that worked. Just when I got used to the old style I need to learn the new way.
Regards


Reply With Quote