如下,我只知道record: 'Item',
但是不知道里边的具体内容 怎样循环遍历得到
var store_daily_submit = new Ext.data.Store({
// load using HTTP url: '
//url: 'sheldon.xml',
url: '../action/MarketInfoController.zcjs?funcflg=getGoodsOrderList',
id:'store_daily_submit',
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'Item',
[color=red] id: 'id'[/color]
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
[color=red]'id2', 'para', 'bsFlag_n', 'price', 'wt_num', 'partQuantity', 'status','subdate','res','fflag','commoditySpecs'[/color]
])
});
Ext.data.XmlReader.prototype.readRecords = Ext.data.XmlReader.prototype.readRecords
.createInterceptor(function(doc) {
var root = doc.documentElement || doc;; // 获取xml root节点
/**
* 把fields解析出来并设置
*/
this.recordType = Ext.data.Record.create([]); //【】设置fields
})
//默认store不支持根据数据设置fields,所以添加函数拦截器同态设置fields。解析代码你自己写吧。
store_daily_submit.each(function(item) {alert(Ext.encode(item.data));})
这个主要是遍历store值并打印,写在store数据加载之后。
你可以在store加载数据时候,获取xml对象吧fields解析出来,设置reader的recordType。
或者你先把xml fields解析出来,在设置store