Question

I've an xml containing a nested structure

<building>
  <name>Bld No.2</name>
  <rooms>
    <room>
      <number>10</number>
    </room>
    <room>
      <number>11</number>
    </room>
  </rooms>
</building>

using model mapping, I can put the data into the grid by this:

fields:[
  {name: 'roomNumber', mapping: 'rooms > room > number'},
  ...
]

and this obviously doesn't work since it only parses the first room and generates one row in the grid.

So how can I make the mapping to parse multiple substructures?

And how can I extend the grid view to support this structure? Something like embedding a tree or list into a grid row would be perfect for me, though I know it's hard.

Était-ce utile?

La solution

You need to create a store and you can bind your grid to this store.

Define the reader in your model as:

reader: {
    type : 'xml',
    record: 'room',
    root: 'rooms'
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top