读书人

ExtJs4 xml reader读取XML资料不行啊

发布时间: 2013-01-04 10:04:13 作者: rapoo

ExtJs4 xml reader读取XML文件,不行啊,新手入门,跪求大神解答!!
用ExtJs的xmlReader读取一个xml文件,现在是文件能取到,但是文件的内容没有读进store里面,以下是写的代码以及一些调试的信息,还请论坛大虾赐教啊~~~ExtJs4 xml reader读取XML资料,不行啊新手入门,跪求大神解答!

主要的java script文件


ExtJs4 xml reader读取XML资料,不行啊新手入门,跪求大神解答!
但是student并没有读取到:ExtJs4 xml reader读取XML资料,不行啊新手入门,跪求大神解答!
ExtJs4 xml reader读取XML资料,不行啊新手入门,跪求大神解答!
这个是一个http响应:
ExtJs4 xml reader读取XML资料,不行啊新手入门,跪求大神解答!

哎,这个东西弄得偶头疼,还请大虾们指点指点,才刚学ExtJs不久,现在跟着uspcat论坛的视频在走……
[解决办法]
Ext.define('common.teacher',{
extend:'Ext.data.Model',
fields:['name'],
proxy: {
type: 'ajax',
url:'Test.TestApplication.TestOneToMany.cls',
reader: {
type: 'xml',
//root: 'teacherList'
record:'teacher'
}
},
hasMany:{model:'common.student', name:'students'}


});
Ext.define('common.student',{
extend:'Ext.data.Model',
proxy: {
type: 'ajax',
url:'Test.TestApplication.TestOneToMany.cls',
reader: {
type: 'xml',
root: 'students',
record:'name'
}
},
fields:[{name:'name',mapping:'/'}],
belongsTo:'common.teacher'
});

var tstore = Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
model:'common.teacher'
});
tstore.load({
callback:function(records){
console.log(records);
alert(records.length);
alert(records[0].students().count());
}
});

需要给两个model都添加代理

读书人网 >JavaScript

热点推荐