1
我有一个Perl脚本,它将XML格式的SOAP请求返回给我的EXTJS4。下面是加载并显示XML的代码(这是我在EXTJS第一次去):EXTJS4 XML存储 - 显示
Ext.onReady(function() {
Ext.Loader.setConfig({enabled:true});
Ext.define('accounts', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'origin', type: 'string'}
]
});
var myStore = Ext.create('Ext.data.Store', {
model: 'accounts',
proxy: {
type: 'ajax',
url: 'cgi-bin/runPerl.pl',
reader: {
type: 'xml',
root: 'soap:Body'
}
},
autoLoad: true
});
myStore.on('load', function(store, records, options) {
var tpl = new Ext.XTemplate(
'<tpl for="Accounts">',
'<h1>{values.data.name}</h1>',
'<h1>{values.data.origin}</h1>',
'</tpl>'
);
//tpl.append(Ext.get("output"), store.getRange());
});
这里是XML:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAccountsResponse xmlns:ns2="http://services.nms.nimsoft.com/">
<Accounts>
<accountId>1</accountId>
<address></address>
<city></city>
<country></country>
<creationDate>2012-04-11T00:00:00+01:00</creationDate>
<description></description>
<fax></fax>
<name>Network</name>
<origin>Support_4</origin>
<phone></phone>
<postalCode></postalCode>
<state></state>
<webSite></webSite>
</Accounts>
</ns2:getAccountsResponse>
</soap:Body>
</soap:Envelope>
萤火虫显示以下内容:
Ext.DomQuery.pseudos[name] is not a function
[Break On This Error]
return Ext.DomQuery.pseudos [name](cs,value);
我已经缩小到tpl部分,但对于我的生活无法理解我得到的错误。
任何人都可以提供建议吗?谢谢!
你为什么不尝试调试'records'有负载处理,看看里面有什么? – sha
上的任何指针?就像我说的那样,这是相当新的。 @sha – Teknetik
在执行'tpl ='之前,添加'console.log(records)'行。通过这种方式,您将在调试控制台中看到数组记录。在那里你可以浏览他们,看到他们的领域和其他一切。可能会给你一些提示。 – sha