1 Reply Latest reply on Jul 18, 2012 8:47 AM by roydene

    Advanced Data Grid - Parent Level

    roydene Level 1

      Hi there,


      I am trying to get the parent level of an advanced data grid and enable a delete button when it is selected.




         private var dpHierarchy:ArrayCollection = new ArrayCollection([

           {Form:"SR1", Level:"root", children: [



            {Form:"Test Data", children: [





           {Form:"MBR2", Level:"root", children: [



            {Form:"Test Data", children: [








        <mx:AdvancedDataGrid id="adg" left="10" right="10" top="10" width="100%" height="250" itemClick="adg_itemClickHandler(event)">


          <mx:HierarchicalData source="{dpHierarchy}"/>



          <mx:AdvancedDataGridColumn dataField="Form" headerText="Flex Forms"/>   




        <s:Button label="Delete" enabled="false" icon="@Embed('assets/delete.png')"/>


      Is there a way that I can check for this?  I even considered looking for the "Level: root" element but can't seem to get it.  Is there a way to do this?





        • 1. Re: Advanced Data Grid - Parent Level
          roydene Level 1

          Okey dokey - seems like I found a way around this


             protected function adg_itemClickHandler(event:ListEvent):void


              if (event.itemRenderer.data.Level == "root"){

               btnDeleteForm.enabled = true;



               btnDeleteForm.enabled = false;




          Seems to work 100%