PDA

View Full Version : Getting an XML node automatically in Xtemplate



dplus
30 Aug 2009, 11:25 AM
Hi,

I am wondering if it is possible to get the nodevalue from a XML document in a Xtemplate without defining it in the Ext.data.Record class first?
I've read that one can extend the template with member functions, but I don't know how I can get a reference to the XML-document being parsed?

So, for your information I've defined an Ext.data.Record, an Ext.data.XMLreader, a store, and a Rowexpander grid.

Suppose I have this xml:
<records>
<record>
<projectname>blah 1</projectname>
<link>http://localhost/blah1</link>
<members>
<member><name>member1</name><link>http://localhost/member1</link></member>
<member><name>member2</name><link>http://localhost/member2</link></member>
</members>
</record>
</records>

Now I've defined the Record object as:
var record = Ext.data.Record.create([
{name: 'projectname'},
{name: 'membername', mapping: 'members/member/name'}
]
);

Now what I want is to automatically get the nodevalue of the node "link" without defining it first in the Record-object.
Can that be done by any means?

Thanks in advance.

dplus
6 Sep 2009, 9:59 AM
Hm, I am currently still searching for a solution, is there anybody who can help?

Condor
6 Sep 2009, 11:01 PM
You need the data somewhere in your record and the 2 fields you defined now don't contain this data. So the only option is to add a field.