<Parent field1="valueA" field2="valueB" > <Child1 field1="value1" field2="value1b" /> <Child2 field1="value2" field2="value2b" /> <Child3 field1="value3" field2="value3b" /> </Parent>
<Parent> <field1>valueA</field1> <field2>valueB</field2> <subnodes> <Child1> <field1>value1</field1> <field2>value1b</field2> </Child1> <Child2> <field1>value2</field1> <field2>value2b</field2> </Child2> <Child3> <field1>value3</field1> <field2>value3b</field2> </Child3> </subnodes> </Parent>
If above data is set as source to HierarchicalData it would treat field1, field2 and subnodes as children of Parent node, which is not correct. To tell HierarchicalData to use only the nodes under subnodes as children set HierarchicalData.childrenField to "subnodes".
The same rules apply when GroupingCollection (which is derived from HierarchicalData) is used to group flat data.
Suppose following data is used as input to GroupingCollection and grouped on Region
<Row> <Region>Southwest</Region> <Territory>Arizona</Territory> <Territory_Rep>Barbara Jennings</Territory_Rep> <Actual>38865</Actual> <Estimate>40000</Estimate> </Row> <Row> <Region>Southwest</Region> <Territory>trials</Territory> <Territory_Rep>Dana Binn</Territory_Rep> <Actual>4000</Actual> <Estimate>5000</Estimate> </Row> <Row> <Region>SouthEast</Region> <Territory>Central California</Territory> <Territory_Rep>Joe Smith</Territory_Rep> <Actual>5000</Actual> <Estimate>6000</Estimate> </Row> <Row> <Region>Southwest</Region> <Territory>Nevada</Territory> <Territory_Rep>Bethany Pittman</Territory_Rep> <Actual>1000</Actual> <Estimate>2000</Estimate> </Row>
The result won't get displayed because the base HierarchicalData would treat <Region>, <Territory> etc nodes also as children of Row. To get proper display we need to set GroupingCollection.childrenField="abc" or some non existent node name. This would cause HierarchicalData to report that no children exist for the Row.
No comments:
Post a Comment