3 Replies Latest reply on Mar 25, 2010 4:57 AM by mfriasv

    Populating lists from grouped array

    mfriasv Level 1

      Hi,

       

      How to group an array so that the different groups are showed in lists? For example, I would like to group the below attached data. The result would be something like:

       

      ArrayCollection1 = parent layer 1, sublayer 1, sublayer 2, sublayer 3

      ArrayCollection2 = parent layer 2, sublayer 5, sublayer 6

       

      And then I would show a list with AC1 and besides a list with AC2.

       

      Thanks,

      Manolo

       

       

        "layers" : [
          {
            "id" : 0,
            "name" : "parent layer 1",
            "parentLayerId" : -1,
            "defaultVisibility" : true,
            "subLayerIds" : [1, 2, 3]
          },
          {
            "id" : 1,
            "name" : "sublayer 1",
            "parentLayerId" : 0,
            "defaultVisibility" : false,
            "subLayerIds" : null
          },
          {
            "id" : 2,
            "name" : "sublayer 2",
            "parentLayerId" : 0,
            "defaultVisibility" : false,
            "subLayerIds" : null
          },
          {
            "id" : 3,
            "name" : "sublayer 3",
            "parentLayerId" : 0,
            "defaultVisibility" : false,
            "subLayerIds" : null
          },
          {
            "id" : 4,
            "name" : "parent layer 2",
            "parentLayerId" : -1,
            "defaultVisibility" : true,
            "subLayerIds" : [5, 6]
          },
          {
            "id" : 5,
            "name" : "sublayer 5",
            "parentLayerId" : 5,
            "defaultVisibility" : false,
            "subLayerIds" : null
          },
          {
            "id" : 6,
            "name" : "sublayer 6",
            "parentLayerId" : 5,
            "defaultVisibility" : false,
            "subLayerIds" : null
          }