Hello,
im new to ExtJS. Im trying to fill a group grid with xml data, but i have problems with the mapping. This is my xml data:
Code:
<result>
<characterNPCStandings>
<rowset name="agents" key="fromID" columns="fromID,fromName,standing">
<row fromID="3008931" fromName="Moorve Alat" standing="9.92"/>
<row fromID="3009132" fromName="Bruune Stienne" standing="3.74"/>
...
</rowset>
<rowset name="NPCCorporations" key="fromID" columns="fromID,fromName,standing">
<row fromID="1000005" fromName="Hyasyoda Corporation" standing="0.14"/>
...
The rowset attribute "name" is the name of my groups, the attributes of the rows are the data i want to show. If i set "record" of the xml reader to row i can already read the row attributes, but how can i set up the reader/model to read rowset and the rows? I read in the API that i can use the convert function for mapping, but i dont know how to use it properly. There are no examples for xml data.
What i tried: (made with Architect)
Code:
Ext.define('MyApp.model.StandingsModel', {
extend: 'Ext.data.Model',
fields: [
{
convert: function(v, rec) {
return rec.get('rowset > row@fromName');
},
name: 'Name',
type: 'string'
},
{
name: 'Standing',
mapping: '@standing',
type: 'string'
}
]
});