3 Replies Latest reply on Feb 15, 2010 11:04 AM by rick@cat

    How do I identify parent item in ADG

    rick@cat

      Hi All,

      Is there any way to identify whether or not you are in a top level (parent) row when using HierarchicalData in an ADG?

       

      Id like to have a checkbox in one of the columns but ONLY for the parent rows and can't seem to find a way to accomplish that. I have an itemRenderer for the checkbox now but it's showing in all the rows, parent and all children when opened.

       

      Thanks in advance,

      Rick

        • 1. Re: How do I identify parent item in ADG
          chris.huston.t10 Level 3

          Have you tried setting the depth parameter for the AdvancedDataGridRendererProvider? This is a way to control what level your renderer appears in the hierarchy.

           

          <mx:rendererProviders>
             <mx:AdvancedDataGridRendererProvider columnIndex="3" depth="2"
                   renderer="yourRendererHere"/>
          </mx:rendererProviders>

           

          Chris

          • 2. Re: How do I identify parent item in ADG
            rick@cat Level 1

            Chris,

            Thanks, that worked. Now my issue is referencing the function I have for the click event of the checkbox since the code is now moved out of my equipment.mxml file. I've been working with flex for about 3 months now and I always have an issue with this. Here's what i tried:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
                <mx:Script>
                    <![CDATA[
                        import mx.core.Application;
                    ]]>
                </mx:Script>
                <mx:CheckBox
                        click="Application.application.equipment.toggleWorkOrder()"
                        selected="false"
                        toolTip="Click to create a work order."
                        horizontalCenter="0" verticalCenter="0"/>
            </mx:Canvas>

             

            The toggleWorkOrder function is public but it's not being activated when I click the box.

             

            Any Ideas?

             

            Thanks again,

            Rick

            • 3. Re: How do I identify parent item in ADG
              rick@cat Level 1

              I found the answer here:

               

              http://livedocs.adobe.com/flex/3/html/help.html?content=modular_7.html

               

              Since the (true) parent of the itemRenderer is a loaded module, I needed to reference my moduleLoader (contentLoader is its ID) in the main application like this:

               

              click="parentApplication.contentLoader.child.toggleWorkOrder()"

               

              That works fine.

              Rick