【发布时间】:2011-01-10 09:29:47
【问题描述】:
我正在用我的 extjs 解析一个 xml,但它只返回五个组件之一。
只有五个组件中的第一个。
Ext.regModel('Card', {
fields: ['investor']
});
var store = new Ext.data.Store({
model: 'Card',
proxy: {
type: 'ajax',
url: 'xmlformat.xml',
reader: {
type: 'xml',
record: 'investors'
}
},
listeners: {
single: true,
datachanged: function(){
Ext.getBody().unmask();
var items = [];
store.each(function(rec){
alert(rec.get('investor'));
});
我的 xml 文件是:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<investors>
<investor>Active</investor>
<investor>Aggressive</investor>
<investor>Conservative</investor>
<investor>Day Trader</investor>
<investor>Very Active</investor>
</investors>
<events>
<event>3 Month Expiry</event>
<event>LEAPS</event>
<event>Monthlies</event>
<event>Monthly Expiries</event>
<event>Weeklies</event>
</events>
<prices>
<price>$0.5</price>
<price>$0.05</price>
<price>$1</price>
<price>$22</price>
<price>$100.34</price>
</prices>
</root>
当我运行代码时,只有“活动”出来。 . . .
我知道我做错了什么,但我不确定是什么......
请帮忙。 . . . .
【问题讨论】:
标签: extjs xml-parsing