i used advance datagrid of dataProvider as HierarchicalData . it’s an my array collection strature
private var groupList:ArrayCollection = new ArrayCollection([
{Country:'India', children:[
{Matches:'India Test series 1',isEnable:false},
{Matches:'India Test series 2',isEnable:false},
{Matches:'India Test series 3',isEnable:false}]},
{Country:'Australia', children:[
{Matches:'Australia Test series 1',isEnable:false},
{Matches:'Australia Test series 2',isEnable:false},
{Matches:'Australia Test series 3',isEnable:false}]},
{Country:'japan', children:[
{Matches:'Australia Test series 1',isEnable:false},
{Matches:'Australia Test series 2',isEnable:false},
{Matches:'Australia Test series 3',isEnable:false}]},
]);
i want to get particular data like matches details and count which one is (isEnable==true) value . so convert HierarchicalCollectionView to Array like
var hCollView:HierarchicalCollectionView = updategrid.dataProvider as HierarchicalCollectionView;
var hCollData:HierarchicalData = hCollView.source as HierarchicalData;
var hArrayColl:ArrayCollection = hCollData.source as ArrayCollection;
var hArray:Array = hArrayColl.source as Array;
for(var i:Number=0;i<hArray.length;i++)
{
Alert.show(hArray[i].Country);
if(hArray[i].isEnable=="true")
{
count1++;
}
}
It shows only country details but if i tried matches and isEnable not found in array . How can i found is isEnable and matches details ? Please refer me
You are still only testing the top level children in your loop. Change it to,
This way, you are looping through the children of each of the top level objects to reach the match objects.
You should probably think about making a typed object for both your Country and Match objects, you’ll be able to encapsulate this type of behaviour much easier.