簡體   English   中英

EXTJS4 XML存儲-顯示

[英]EXTJS4 XML Store - Displaying

我有一個Perl腳本,該腳本將XML格式的SOAP請求返回到我的EXTJS4。 這是加載和顯示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());

    });

這是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顯示以下內容:

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

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

我將其范圍縮小到tpl部分,但是對於我的生命來說,我無法理解我所遇到的錯誤。

任何人都可以提供建議嗎? 謝謝!

嘗試將您的讀者定義更改為:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM