PDA

View Full Version : Ext.data.Record mapping on multiple xml-nodes



omdb
5 Aug 2007, 4:49 AM
Hi there,

I'm using a ComboBox with an XmlReader to fetch data for a livesearch. Here is what my xml looks like:


<results>
<hits>1</hits>
<person>
<id>1461</id>
<name>George Clooney</name>
<jobs>
<job id="15">Actor</job>
<job id="16">Producer</job>
</jobs>
</person>
</results>

Now I'm trying to display all jobs of George in my ComboBox Template and can't find a way to collect all jobs. If I'm setting the mappings to {name: 'jobs', mapping: 'jobs/job'}, i will just get the first record, but not all.

If I'm trying to use a mapping to {name: 'jobs', mapping: 'jobs'} with a converter function, the converter just gets an empty string (understandable, as jobs doesn't have any value). But i would like to have a method, to get all child-elements to a coverter function, to build the value i want to display.

Is there any way, to map such a xml structure to a record?

Cheers,
Benjamin

matjaz
5 Aug 2007, 8:48 AM
Current limitation of Record class is that property can have only one value.

I'm also struggling with same problem in my application.
I wrote my own reader that supports multiple values for one property.
Now all widgets must be adjusted to that and thats as Jack wrote "non-trivial" job. :)

At the present ComboBox does not accept multi values.

omdb
5 Aug 2007, 8:51 AM
Thanks for your answer... do you know if this is going to change in 2.0?