简体   繁体   English

EXTJS4 XML存储-显示

[英]EXTJS4 XML Store - Displaying

I have a Perl script which returns an XML formatted SOAP request to my EXTJS4. 我有一个Perl脚本,该脚本将XML格式的SOAP请求返回到我的EXTJS4。 Here is the code that loads and displays the XML (this is my first go at EXTJS): 这是加载和显示XML的代码(这是我第一次使用EXTJS):

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());

    });

Here is the XML: 这是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>

Firebug displays the following: Firebug显示以下内容:

Ext.DomQuery.pseudos[name] is not a function
[Break On This Error] 

return Ext.DomQuery.pseudos[name](cs, value); 返回Ext.DomQuery.pseudos [name](cs,value);

I have narrowed this down to the tpl section but for the life of me cannot understand the error I am getting. 我将其范围缩小到tpl部分,但是对于我的生命来说,我无法理解我所遇到的错误。

Can anyone offer advise please? 任何人都可以提供建议吗? Thanks! 谢谢!

Try to change your reader definition as: 尝试将您的读者定义更改为:

reader: {
    type: 'xml',
    // root: 'soap:Body',
    record: 'Accounts'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM