Mike
Mike

Reputation: 302

Accessing XML elements in an ExtJS Store that are located outside of the defined records

In ExtJS 4, I have an XML Store that is defined as follows:

Ext.define('AC.store.GameWins',
{
    extend : 'Ext.data.Store',
    model : 'AC.model.GameWins',
    autoLoad : true,

    proxy :
   {
        type : 'ajax',
        api :
        {
            read : 'data/gamewins.xml'
        },
        reader :
        {
            type : 'xml',
            root : 'GameWins',
            record : 'Game',
            successProperty : 'success'
        }
    }
});

and an XML file that looks like this:

<GameWins>  
    <LastUpdated>2013-01-30 10:18:34</LastUpdated>
    <Game ID="1" Name="GameName">
        <WinDate>...</WinDate>
        <WinAmount>...</WinAmount>
    </Game>
    <Game ID="1" Name="GameName">
        <WinDate>...</WinDate>
        <WinAmount>...</WinAmount>
    </Game>
</GameWins>

It is easy enough to access the Game elements in a dataview using an XTemplate.

However, I have a problem accessing LastUpdated.. This is not part of the "record" that is defined in the Store. How can I access this element?

Upvotes: 0

Views: 790

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30082

The raw data from the response is stored in the reader (in this case, the responseXML):

var xml = store.getProxy().getReader().rawData;

Upvotes: 1

Related Questions