0 Replies Latest reply on Jul 21, 2009 10:07 AM by jomelia

    AdvancedDataGrid itemrenderer gripes

    jomelia Level 1

      After a year of begging, I finally got my company to upgrade my FlexBuilder to the Professional edition for the Data Visualization goodies in there. So i've been playing around with the advancedDataGrid: is it me or does it seem a little half-baked? Don't want to go off topic before I get to my topic so I won't go into it now, but it hasn't been a smooth ride so far.

       

      Case in point, itemRenderers. I have a flat xml file displaying data as hierarchical using grouping, and applying a stylefunction to the tree with mixed results. For the top-level text item in the tree I want to add a link, so I thought, no problem, I'll add an itemrenderer with a linkbutton. When I apply it I lose everything in that column.  Here's my adg:

       

      <mx:AdvancedDataGrid id="myADG" styleFunction="myRowStyleFunction"
              width="100%" height="100%" sortExpertMode="true"
              initialize="gc.refresh();"
              styleName="enhancedChargesGrid"
              verticalGridLineColor="#ffffff"  headerHeight="20">
             
              <mx:dataProvider>
                  <mx:GroupingCollection id="gc" source="{adgChargesList}" childrenField="undefined">
                      <mx:grouping>
                          <mx:Grouping>
                              <mx:GroupingField name="ServiceType" descending="true" id="st">
                             
                                  <mx:summaries>
                                    <mx:SummaryRow summaryPlacement="group">
                                      <mx:fields>
                                          <mx:SummaryField dataField="Charges"
                                              label="Charges" operation="SUM"/>
                                          <mx:SummaryField dataField="Accounts"
                                              label="Accounts" operation="SUM"/>
                                      </mx:fields>
                                    </mx:SummaryRow>
                                  </mx:summaries>
                             
                              </mx:GroupingField>
                              <mx:GroupingField name="Charge" descending="true" >
                             
                                  <mx:summaries>
                                    <mx:SummaryRow summaryPlacement="group">
                                      <mx:fields>
                                          <mx:SummaryField dataField="Charges"
                                              label="Charges" operation="SUM"/>
                                             <mx:SummaryField dataField="Accounts"
                                              label="Accounts" operation="SUM"/>
                                      </mx:fields>
                                    </mx:SummaryRow>
                                  </mx:summaries>
                               
                              </mx:GroupingField>
                            
                          </mx:Grouping>
                      </mx:grouping>
                  </mx:GroupingCollection>
              </mx:dataProvider> 
            
              <mx:columns>
                  <mx:AdvancedDataGridColumn id="cgeCol" dataField="ChargeType" styleFunction="myColStyleFunc"
                      headerText="" width="200" fontWeight="normal"/>
                  <mx:AdvancedDataGridColumn dataField="Accounts" headerText="Accounts" textAlign="right" fontWeight="bold"/>
                  <mx:AdvancedDataGridColumn dataField="Usage" headerText="Usage" textAlign="right"/>
                  <mx:AdvancedDataGridColumn dataField="Units" headerText="Units" textAlign="left"/>
                  <mx:AdvancedDataGridColumn dataField="UnitCharges" headerText="Unit Charges"/>
                  <mx:AdvancedDataGridColumn dataField="Charges" id="cges" headerText="Charges" fontWeight="bold" textAlign="right" formatter="{ccyFormatter}"/>
              </mx:columns>

       

                <mx:rendererProviders>
                   <mx:AdvancedDataGridRendererProvider
                      column="{cgeCol}"
                      depth="1"
                      columnSpan="1"
                      renderer="renderers.adgRenderer"/>
                </mx:rendererProviders>

       

          </mx:AdvancedDataGrid>

       

      My simple renderer:

       

      <mx:LinkButton xmlns:mx="http://www.adobe.com/2006/mxml"
           label="{data.ServiceType}" fontWeight="bold" fontSize="14"/>

       

      And a sample of my XML:

       

      <charges>
        <item>
          <ServiceType>Total Subscriber Charges</ServiceType>
          <Charge>Usage Charges</Charge>
          <ChargeType>Voice - Cellular</ChargeType>
          <Accounts>9</Accounts>
          <Usage>55184</Usage>
          <Units>mins</Units>
          <UnitCharges>0.072</UnitCharges>
          <Charges>3950.08</Charges>
        </item>

      </charges>

       

      This worked well in the regular datagrid. I suspect it has something to do  with the groupings but nothing I've goggled for has uncovered anything like that. Any help would be appreciated.

       

      Jack