12 Replies Latest reply on Nov 12, 2009 11:58 AM by GeorgeWS

    AdvancedDataGridRendererProvider

    GeorgeWS Level 1

      I have been at this all day everyday for almost a month. I have an ADG filled with an arrayCollection from a RO. I have read all about the

      AdvancedDataGridRendererProvider I can get the column spanning and the right row but not the right data. I read that this works:

       

      note: the data I want is REMA2W (this is a long description) this is called summaryRenderer.mxml

       

       

       

       

       

       

       

      <mx:Canvas

       

      xmlns:mx="http://www.adobe.com/2006/mxml">

       

       

      <mx:Label id="rowLabel" textAlign="left" width="100%">

       

       

      <mx:Script>

      <![CDATA[

       

       

       

       

      override public function set data(value:Object):void

      {

       

       

      super

      .data = value;

       

       

       

      rowLabel.htmlText = data.REMA2W;

      }

       

      ]]>

       

       

      </mx:Script>

       

       

       

      </mx:Label>

       

      But sadly it does not. If I do this: rowLabel.htmlText = data.GroupField; I get the data but its not what I want.

       

      This is my renderer:

       

       

       

       

       

      <mx:rendererProviders>

       

       

      <mx:AdvancedDataGridRendererProvider dataField="REMA2W" columnSpan="5" columnIndex="0" depth="1"

      renderer="

      SummaryRenderer"/>

       

       

      </mx:rendererProviders>

       

      How do I see what the data that is available to me is?

       

      This is my ADG:

       

      <mx:AdvancedDataGrid

       

      id="adg" defaultLeafIcon="{null}" displayItemsExpanded="true" width="100%" height="100%" themeColor="#73B9B9" initialize="gc.refresh()">

       

       

      <mx:dataProvider>

       

      <mx:GroupingCollection id="gc" source="{myWine}">

       

      <mx:Grouping groupingObjectFunction="grpObjFunc">

       

      <mx:GroupingField id="gf" name="myHeader">

       

       

      <mx:Array id="summ">

       

      <mx:SummaryRow summaryPlacement="group">

       

      <mx:fields>

       

      <mx:SummaryField dataField="REMA2W" label="REMA2W"/>

       

      <mx:SummaryField dataField="myList" operation="SUM" label="myTotal"/>

       

      </mx:fields>

       

      </mx:SummaryRow>

       

      </mx:Array>

       

      </mx:GroupingField>

       

       

       

      </mx:Grouping>

       

      </mx:GroupingCollection>

       

      </mx:dataProvider>

       

       

      <mx:groupedColumns>

       

      <mx:AdvancedDataGridColumn dataField="CMPT2W" headerText="Item" width="110"/>

       

      <mx:AdvancedDataGridColumn dataField="DESCRIP" headerText="Desc"/>

       

      <mx:AdvancedDataGridColumn dataField="SDIVDE" headerText="Size" width="50"/>

       

      <mx:AdvancedDataGridColumn dataField="NOFF2W" headerText="Btls" width="50" textAlign="right"/>

       

      <mx:AdvancedDataGridColumn dataField="BPRC5W" headerText="Inc BBC" width="60" textAlign="right" />

       

      <mx:AdvancedDataGridColumn dataField="myList" headerText="List" width="60" textAlign="right" />

       

      <mx:AdvancedDataGridColumn dataField="myTotal" itemRenderer="NumberItemRenderer" headerText="Cost" width="60" textAlign="right"/>

       

      <mx:AdvancedDataGridColumnGroup headerText="Inventory">

       

      <mx:AdvancedDataGridColumn dataField="INV_41" headerText="Morgan Hill" width="60" textAlign="right" visible="{myDetail.selected}"/>

       

      <mx:AdvancedDataGridColumn dataField="INV_31" headerText="Chino" width="60" textAlign="right" visible="{myDetail.selected}"/>

       

      </mx:AdvancedDataGridColumnGroup>

       

      </mx:groupedColumns>

       

       

      <mx:rendererProviders>

       

      <mx:AdvancedDataGridRendererProvider dataField="REMA2W" columnSpan="6" columnIndex="0" depth="1"

      renderer="

      com.esria.samples.dashboard.view.SummaryRenderer"/>

       

      </mx:rendererProviders>

       

       

       

      </mx:AdvancedDataGrid>

       

      I have read that the data. property has all the elements from the row. I just dont know how to see them.

      EVERYTHING in my app works perfect except landing the REMA2W in the group and in the 2nd column.

       

      Thanks

      George

       

        • 1. Re: AdvancedDataGridRendererProvider
          paul.williams Level 4

          Summary rows are generated by the GroupingCollection so they do not contain the same sets of fields as your data rows. In your example your summary rows will contain the following fields:

           

          GroupLabel - the label for your group as defined by your GroupingField

          REMA2W - a summation of all the REMA2W fields in the corresponding group

          myTotal - a summation of all the myList fields in the correspinding group

          children - an array of the group's child rows

           

          I'm basing this on the "Creating Summary Rows" section of the link below (search for "Internally, the GroupingCollection"):

           

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

           

          Previously I asked you to put in the following debug code:

           

          for ( var property : String in data )

          {

               trace( property + ": " + data[ property ] );

          }

           

          You replied that you saw the following: grouping label, the cost field, an NaN and an Object. That's 4 fields as expected. Unfortunately you did not follow the instructions exactly so we got no property names. I would suggest trying again to get property names and values using this approach.

           

           

           

           

           


          • 2. Re: AdvancedDataGridRendererProvider
            GeorgeWS Level 1

            I see the 4 parts:

             

            REMA2W : NaN

            children: [object Object]

            myTotal: 174

            GroupLabel: 900051111      HARDY VS 6B

            uid: 900051111      HARDY VS 6B

             

             

            This is what I want REMA2W to be: Purchase 5 bottles Hardy VS Ltr & receive 1 bottle Hardy VS AAD, No BCC. ($19.58 Net BC)

             

            So now that I see what going to the SummaryRenderer. I see that there is nothing for the REMA2W so this is not possible?

             

            I read online and in Flex 3 Training from the Source that this should work:

             

            data.REMA2W

             

            Thanks

            George

            • 3. Re: AdvancedDataGridRendererProvider
              paul.williams Level 4

              Ok, I'm coding this blind so it may not work the first time, but try the following in your renderer:

               

              override public function set data(value:Object):void
              {
                 super.data = value;


                 var groupChildren : Array = data.children as Array;
                 if ( groupChildren.length > 0 )
                 {
                    var firstRowInGroup : Object = groupChildren[ 0 ];
                    rowLabel.htmlText = firstRowInGroup.REMA2W;
                 }
                 else
                 {
                    rowLabel.htmlText = "n/a";
                 }
              }

              It attempts to get the REMA2W field of the first row in the group.

              • 4. Re: AdvancedDataGridRendererProvider
                GeorgeWS Level 1

                I wish I could be pressing the Answered button, but the result freezes the screen. I have been stuck on Fex stuff for days but weeks, almost a month is rediculous. Any other thoughts. Is there a function in Flex that will chop off the first 50 chars? That would do it

                 

                Thanks again

                 

                George

                • 5. Re: AdvancedDataGridRendererProvider
                  paul.williams Level 4

                  Do you have the debug player installed?

                   

                  There is probably an error being thrown, try the following:

                   

                  override public function set data(value:Object):void
                  {
                    super.data = value;

                   

                    try

                    {
                       var groupChildren : Array = data.children as Array;
                       if ( groupChildren.length > 0 )
                       {
                           var firstRowInGroup : Object = groupChildren[ 0 ];
                           rowLabel.htmlText = firstRowInGroup.REMA2W;
                       }
                       else
                       {
                           rowLabel.htmlText = "n/a";
                       }

                     }

                     catch ( e : Error )

                     {

                        rowLabel.htmlText = e.message;

                     }
                  }

                  • 6. Re: AdvancedDataGridRendererProvider
                    GeorgeWS Level 1

                    I have tried many times to install the debugger edition but never works. Thats as painful as this issue.

                    But what you sent to me does produce an error (surprisingling exactally where I want my REMA2W.

                    The error is: error #1009

                     

                    Not sure what that means

                    • 7. Re: AdvancedDataGridRendererProvider
                      paul.williams Level 4

                      Unfortunately without debugging tools this is going to require some trial and error, but we are making progress. Try the following and tell me what appears in your field:

                       

                      import flash.utils.getQualifiedClassName;

                       

                      override public function set data(value:Object):void
                      {
                        super.data = value;

                       

                        try

                        {
                           rowLabel.htmlText = getQualifiedClassName( data.children );

                        }

                        catch ( e : Error )

                        {

                           rowLabel.htmlText = e.message;

                        }

                      }

                      • 8. Re: AdvancedDataGridRendererProvider
                        GeorgeWS Level 1

                        I get this:

                         

                        faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: 'http://intranet.youngsmarket.com/flex2gateway/''

                         

                         

                        and nothing loads

                        • 9. Re: AdvancedDataGridRendererProvider
                          paul.williams Level 4

                          I think that's a separate issue. A 500 error indicates an internal server fault.

                          • 10. Re: AdvancedDataGridRendererProvider
                            GeorgeWS Level 1

                            OK got that issue solved (JRun hangs almost once a day, sucks) anyways I get this:

                             

                            mx:collections::ArrayCollection

                            • 11. Re: AdvancedDataGridRendererProvider
                              paul.williams Level 4

                              Ok that explains our earlier error. Try this:

                               

                              override public function set data(value:Object):void
                              {
                                super.data = value;

                               

                                try

                                {
                                   var groupChildren : ArrayCollection = data.children as ArrayCollection;
                                   if ( groupChildren.length > 0 )
                                   {
                                       var firstRowInGroup : Object = groupChildren[ 0 ];
                                       rowLabel.htmlText = firstRowInGroup.REMA2W;
                                   }
                                   else
                                   {
                                       rowLabel.htmlText = "n/a";
                                   }

                                 }

                                 catch ( e : Error )

                                 {

                                    rowLabel.htmlText = e.message;

                                 }
                              }

                              • 12. Re: AdvancedDataGridRendererProvider
                                GeorgeWS Level 1

                                Paul,

                                Your are a true master, thanks for hanging in there with me.

                                 

                                George