19 Replies Latest reply on Nov 3, 2009 9:25 AM by paul.williams

    Renderer Component

    GeorgeWS Level 1

      I have a renderer component that looks like this:

       

       

       

       

       

       

       

       

      <mx:Canvas

       

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

       

       

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

       

       

      <mx:Script>

      <![CDATA[

       

       

      import mx.controls.Alert;

       

       

       

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

       

      {

       

       

      super.data = value;

       

      rowLabel.htmlText = data.REMA2W;

      }

      ]]>

       

       

      </mx:Script>

       

       

      </mx:Label>

       

      Looks like the samples I see but does not show any data. I have tried alot, posted alot and it does not seem to be an issue for anyone else. How can I show data where the rowLabel is?

       

      REMA2W is a long description and myWine is the ArrayCollection

       

      Have tried:

      data.REMA2W

      value.REMA2W

      parentDocument.myWine.getItemAt(0).REMA2W - this shows the first record but cannot seem to just get each row, I'd think it would be like this:

      parentDocument.myWine.REMA2W but no go.

      I have also tried looping but I dont think thats right either

      Any thoughts would be great this is the 3rd week I have been at this.

       

      Thanks

      George

       

        • 1. Re: Renderer Component
          paul.williams Level 4

          Can you post the source of the view containing the List / DataGrid? What type of object do you have in your ArrayCollection?

          • 2. Re: Renderer Component
            GeorgeWS Level 1

            This is my ADG it gets filled in from a remote Object...

             

            <mx:AdvancedDataGrid

             

             

            id="adg" 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" minWidth="175"/>

             

             

            <mx:AdvancedDataGridColumn dataField="DESC2W" 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="com.esria.samples.dashboard.view.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="5" columnIndex="1" depth="1"

            renderer="

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

             

             

            </mx:rendererProviders>

             

             

             

             

            </mx:AdvancedDataGrid>

            • 3. Re: Renderer Component
              mac_martine Level 1

              It would still help to see what the remote object looks like, but you're setting the dataField of the datagrid as an 'REMA2W' object, but then you try to get that again inside the renderer.

              This means that inside the item renderer, the 'data' object is of type 'REMA2W', so in there you need to reference a property of that type. I'm assuming that the object 'REMA2W' does not contain another 'REMA2W' object, which is what you're currently trying to access.

              • 4. Re: Renderer Component
                mac_martine Level 1

                Is REMA2W a string? if so, just use 'data' inside the renderer

                • 5. Re: Renderer Component
                  GeorgeWS Level 1

                  So I try this:

                   

                  rowLabel.htmlText = data.toString();

                   

                  and get [object Object]

                   

                   

                  My RO is like this

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                  <mx:RemoteObject id="qCombos" destination="ColdFusion" source="Combos"

                  showBusyCursor="

                  true">

                   

                   

                  <mx:method name="Combos" result="handleQueryResult( event )" fault="Alert.show(event.fault.message)">

                   

                   

                  <mx:arguments>

                   

                   

                  <supplierid>{SupplierID}

                  </supplierid>

                   

                   

                  </mx:arguments>

                   

                   

                  </mx:method>

                   

                   

                   

                   

                   

                  public

                   

                   

                  {

                  myWine=event.result

                  as ArrayCollection;

                  }

                   

                  the REMA2W is a column in my database thats char(150)

                   

                   

                  function handleQueryResult(event:ResultEvent):void

                  • 6. Re: Renderer Component
                    mac_martine Level 1

                    'REMA2W' is not a string then. Show us the code that builds the object.

                     

                    Or set a breakpoint on 'rowLabel.htmlText = data.toString();', then Debug. When you hit the breakpoint inspect the 'data' object in the variables panel and see if it's what you expected -- and check the properties of it.

                    • 7. Re: Renderer Component
                      GeorgeWS Level 1

                       

                       

                       

                       

                       

                      public

                       

                      function openGridItem():void

                      {

                       

                      if (adg.dataProvider is IHierarchicalCollectionView)

                      {

                       

                      var openNodes:Object = IHierarchicalCollectionView(adg.dataProvider).openNodes;

                      gf.summaries = summ;

                      count = 0;

                      gc.refresh();

                      adg.dataProvider = gc;

                      adg.validateNow();

                      IHierarchicalCollectionView(adg.dataProvider).openNodes = openNodes;

                      }

                      }

                       

                      Thanks alot for looking

                       

                       

                       

                       

                      G

                      • 8. Re: Renderer Component
                        mac_martine Level 1

                        we need the code that defines and sets 'REMA2W' in your remote object.

                        • 9. Re: Renderer Component
                          paul.williams Level 4

                          Put a breakpoint on that line and check the contents of your data object

                          to ensure that the field you want exists.

                           

                          Alternatively add the following line and run in debug mode:

                           

                              trace( describeType( data ) );

                          • 10. Re: Renderer Component
                            GeorgeWS Level 1

                            Im not sure what this means:

                             

                            <type name="Object" isDynamic="true" isFinal="false" isStatic="false">
                              <method name="propertyIsEnumerable" declaredBy="Object" returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
                                <parameter index="1" type="*" optional="true"/>
                              </method>
                              <method name="hasOwnProperty" declaredBy="Object" returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
                                <parameter index="1" type="*" optional="true"/>
                              </method>
                              <method name="isPrototypeOf" declaredBy="Object" returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
                                <parameter index="1" type="*" optional="true"/>
                              </method>
                            </type>

                             

                            But I do not see any variables that I want

                            • 11. Re: Renderer Component
                              paul.williams Level 4

                              Ok, second time lucky, try:

                               

                              for ( var property : String in data )

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

                              }

                              • 12. Re: Renderer Component
                                GeorgeWS Level 1

                                Well I get data, but not what I am looking for. I get the "Grouping Label" that is exactally the same field that my tree uses; leaving the first column the same as my second column (the column im trying to fill with the AdvancedDataGridRendererProvider. I also get the Cost column and an [object Object] as well as a "Nan". It looks like all the fields are not available.

                                 

                                This is what I dikd to show me

                                 

                                 

                                 

                                 

                                 

                                 

                                override

                                 

                                 

                                public function set data( value:Object ):void

                                 

                                {

                                 

                                 

                                super.data = value;

                                 

                                rowLabel.htmlText = data.toString();

                                 

                                 

                                for ( var property : String in data )

                                {

                                Alert.show( data[ property ] );

                                }

                                }

                                 

                                I use the Alert because my setup does not work in debug, I know painful

                                 

                                Thanks

                                George

                                • 13. Re: Renderer Component
                                  paul.williams Level 4

                                  I would suggest backtracking and getting your data to display in a very simple, flat datagrid. Just create a grid and set the dataprovider without specifying any columns. Then work your way step by step from there to where you want to go.

                                  • 14. Re: Renderer Component
                                    GeorgeWS Level 1

                                    Thanks for your help, I am very very far along on my app. my ADG already shows grouped records with a summary total in the group when the tree is opened I see the items and fields for them all works perfect accept seeing the REMA2W field in the data. I attached a file so you can see where I am at:

                                    Where the [object Object] is is where I want my REMA2W column to be. If I add the REMA2W fields as a column in the ADG I see it just fine. Im stumped

                                     

                                    thanks again

                                     

                                    George

                                    • 15. Re: Renderer Component
                                      paul.williams Level 4

                                      What values are you expecting for the REMA2W field? Can you add a normal column to display this field in each row?

                                      • 16. Re: Renderer Component
                                        GeorgeWS Level 1

                                        The field REMA2W should have stuff like 'Buy 2 bottles get one free'

                                         

                                        I have added it as a regular column but the decriptions are to long (so Im spanning columns) also the 'Description' is in each record so needs to be grouped otherwise there will be a repeated description for each item.

                                         

                                        G

                                        • 17. Re: Renderer Component
                                          paul.williams Level 4

                                          So I may be missing something because I'm not too familiar with grouping, but you have it specified as a SummaryField. The default operation for SummaryField is SUM. So it looks to me like you are attempting to perform a sum operation on a text property.

                                           

                                          Is the value of REMA2W expected to be the same for all rows in the group? If so you could define a summaryFunction on this SummaryField to return the value of REMA2W for the first row in the group.

                                          • 18. Re: Renderer Component
                                            GeorgeWS Level 1

                                            This is true that I am putting text in the summaryField. What makes me think this is even possible is that if I use groupLabel in the summaryRenderer it puts the Label in the correct spot and is diplaying the short description perfectly, I just dont want the groupLabel I want another field "REMA2W" How can I see all the fields that are available to me?

                                             

                                            Thanks

                                            G

                                             

                                            sorry I keep posting aboput this but I CANNOT settle (give up) I have been working on this app for 6 months and this is the very very last part, putting the long description in.

                                            • 19. Re: Renderer Component
                                              paul.williams Level 4

                                              To test my suspicion, try setting the operation to COUNT on your REMA2W summary field. You can't sum text fields, but you can count them, so you should at least get a valid result.