5 Replies Latest reply on Feb 22, 2010 2:08 PM by Sam Souhrada

    AdvancedDataGrid ItemRenderer Issue using code behind method

    Sam Souhrada Level 1

      I have been trying to get an itemrenderer to correctly work in an advanveddatagrid. I've used several itemrenderers in the past so this is pretty basic. I haven't however tried to attach to a grid that is inside a page using the code behind method. My issue is that the grid breaks if I try to put more than one visual component on the renderer. See the images below:

       

      Here is an example with a plain canvas itemrenderer:

       

      plainCanvas.JPG

      As you can see the scroll bar appears and everything looks normal.

       

       

      Here is the behavior if I add a label inside this component:

       

      canvasText.JPG

       

      The scroll bar disappears and I'm unable to close the itemrenderer correctly.

       

       

      Has anyone come across this issue before? Thanks for any help on this one!

        • 1. Re: AdvancedDataGrid ItemRenderer Issue using code behind method
          archemedia Level 4

          Can you post some code to test with?

          Dany

          • 2. Re: AdvancedDataGrid ItemRenderer Issue using code behind method
            Sam Souhrada Level 1

            I can't post all of the code since it's on a much larger page but hopefully this gives you an idea:

             

            <custom:ClientPlans xmlns:mx="http://www.adobe.com/2006/mxml" width="920" height="550" xmlns:flexlib="http://code.google.com/p/flexlib/"
                    fontFamily="HelveticaNeue Condensed" fontSize="11"
                    xmlns:components="components.*"
                    disabledColor="#FFFFFF"
                    themeColor="#FFFFFF"
                    horizontalScrollPolicy="off"
                    verticalScrollPolicy="off" 
                    backgroundColor="#ffffff"
                    cornerRadius="10"
                    borderStyle="solid"
                    borderThickness="0"
                    horizontalCenter="0" verticalCenter="0" color="#808080">

             

            <mx:AdvancedDataGrid id="adgPlans" width="100%" height="497" selectionMode="singleRow" editable="false"
                                    color="#000000" fontSize="14" selectable="true"
                                    liveScrolling="false"
                                    showHeaders="false" variableRowHeight="true"
                                    disclosureOpenIcon="@Embed(source='/images/gridMinus.png')"
                                    disclosureClosedIcon="@Embed(source='/images/gridPlus.png')"
                                    folderOpenIcon="@Embed(source='/images/folderOpenIcon.png')"
                                    folderClosedIcon="@Embed(source='/images/folderclosedIcon.png')" borderThickness="1" borderStyle="solid">
                                      <mx:dataProvider>
                                             <mx:GroupingCollection id="gcGroup">
                                                    <mx:grouping>
                                                        <mx:Grouping>
                                                            <mx:GroupingField name="ClientName"/>
                                                        </mx:Grouping>
                                                    </mx:grouping>
                                             </mx:GroupingCollection>
                                      </mx:dataProvider>       
                                    <mx:columns>
                                        <mx:AdvancedDataGridColumn id="clientNameColumn" dataField="clientName" headerText="Client" sortable="true" width="200" />
                                       
                                    </mx:columns>
                                   
                                   
                                    <mx:rendererProviders>
                                        <mx:AdvancedDataGridRendererProvider
                                            column="{clientNameColumn}"
                                            columnSpan="0"
                                            depth="2"
                                            renderer="components.subcomponents.clientRenderer3"/>
                                    </mx:rendererProviders>
                                   
                                   
                                </mx:AdvancedDataGrid>

             

            </custom:ClientPlans>

             

             

            Code-Behind:

             

            // ActionScript file
            package com.name
            {
                    import mx.controls.AdvancedDataGrid;
                   
               
                public class ClientPlans extends Canvas
                {
                    public var adgPlans:AdvancedDataGrid;

                 }

             

                 public function ClientPlans ()
                    {
                        super();
                        this.addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);

             

                    }
                   
                    private function creationCompleteHandler (event:FlexEvent):void
                    {
                          trace("cc");

                    }

            }

             

             

            Item Renderer:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
                width="100%" height="150" borderStyle="solid" borderThickness="2" borderColor="#56ACD1" cornerRadius="8"
                fontFamily="HelveticaNeue Condensed" color="#000000" backgroundColor="#FFFFFF" backgroundAlpha="1.0">
                <mx:Label text="Hello!?"/>
            </mx:Canvas>

            • 3. Re: AdvancedDataGrid ItemRenderer Issue using code behind method
              Sam Souhrada Level 1

              The only way I have gotten this to work is by setting the openDuration="0" ...

               

              Has anyone run into this before where the AdvancedDataGrid doesn't refresh properly if the openDuration is > 0 ?

               

               

              mx:AdvancedDataGrid id="adgPlans" width="100%" height="400" selectionMode="singleRow" editable="false"
                                      color="#000000" fontSize="14" selectable="true" openDuration="0" liveScrolling="false"
                                      showHeaders="false" variableRowHeight="true"
                                      disclosureOpenIcon="@Embed(source='/images/gridMinus.png')"
                                      disclosureClosedIcon="@Embed(source='/images/gridPlus.png')"
                                      folderOpenIcon="@Embed(source='/images/folderOpenIcon.png')"
                                      folderClosedIcon="@Embed(source='/images/folderclosedIcon.png')" borderThickness="1" borderStyle="solid">
                                        <mx:dataProvider>
                                               <mx:GroupingCollection id="gcGroup">
                                                      <mx:grouping>
                                                          <mx:Grouping>
                                                              <mx:GroupingField name="ClientName"/>
                                                          </mx:Grouping>
                                                      </mx:grouping>
                                               </mx:GroupingCollection>
                                        </mx:dataProvider>       
                                      <mx:columns>
                                          <mx:AdvancedDataGridColumn id="clientNameColumn" dataField="clientName" headerText="Client" sortable="true" width="200" />                           
                                      </mx:columns>
                                     
                                     
                                      <mx:rendererProviders>
                                          <mx:AdvancedDataGridRendererProvider
                                              columnIndex="0"
                                              columnSpan="0"
                                              depth="2"
                                              renderer="components.subcomponents.clientRenderer2"/>
                                      </mx:rendererProviders>
                                     
                                     
                                     
                                     
                                  </mx:AdvancedDataGrid>

              • 4. Re: AdvancedDataGrid ItemRenderer Issue using code behind method
                Sam Souhrada Level 1

                I've posted some test code on another thread I created which is a very similar issue. I've narrowed it down to all ItemRenderers for any object... not just ADGs.

                 

                http://forums.adobe.com/thread/580862

                 

                I appreciate the help!

                 

                Thanks

                • 5. Re: AdvancedDataGrid ItemRenderer Issue using code behind method
                  Sam Souhrada Level 1

                  addEventListener(Event.ENTER_FRAME, everyFrame);

                   

                  commenting this out allowed the item renderers to display - Hope this helps out anyone stuck on this issue.

                   

                  Thanks