4 Replies Latest reply on Oct 15, 2009 12:13 PM by Handycam

    Advanced Data Grid - grouping label column span?

    Handycam Level 1

      When I make the column a proper width for the layout, it clips the grouping label.  See image.

       

      http://grab.by/9iT

       

      Is there a way to perhaps have this span multiple columns, to avoid being clipped or widening the column?

        • 1. Re: Advanced Data Grid - grouping label column span?
          Sameer Bhatt Adobe Employee

          Use rendererProviders property of the AdvancedDataGrid and specify column span.

           

          An example of using rendererProviders can be found here -

          http://techrays.wordpress.com/2007/12/06/accessing-groupinglabel-in-summary-rows-in-advanc eddatagrid/

           

          -Sameer

          • 2. Re: Advanced Data Grid - grouping label column span?
            Handycam Level 1

            This does nothing for me.  i am not sure how to use this in my context.  The example on your site is using this for an additional row as a summary.

             

            What I need to do is set the grouping label to be multi-column, and display ONLY the label data.

             

            As you can see, it doesn't fit in the first column:

            http://grab.by/9uI

            I tried using your example, but which column would "col1" be?  It's the label, not one of the columns:

            <mx:AdvancedDataGrid id="shoppingGrid" dataProvider="{groupingColl}" width="100%" height="100%" styleName="shoppingGrid" 
                                      displayItemsExpanded="true" showHeaders="false" borderStyle="none" styleFunction="shoppingGrid_styleFunction">
                 <mx:columns>
                      <mx:AdvancedDataGridColumn dataField="@qty" width="120" textAlign="right" labelFunction="formatAsFraction"/>
                      <mx:AdvancedDataGridColumn dataField="@units" width="100" />
                      <mx:AdvancedDataGridColumn dataField="@caption"/>
                 </mx:columns>
                 <mx:rendererProviders>
                      <mx:AdvancedDataGridRendererProvider column="{col1}" columnSpan="2" dataField="@section" />
                 </mx:rendererProviders>
            </mx:AdvancedDataGrid>
            

            This example does nothing. I also tried adding a column for the label data field:

            <mx:AdvancedDataGrid id="shoppingGrid" dataProvider="{groupingColl}" width="100%" height="100%" styleName="shoppingGrid" 
                                 displayItemsExpanded="true" showHeaders="false" borderStyle="none" styleFunction="shoppingGrid_styleFunction">
            <mx:columns>
                 <mx:AdvancedDataGridColumn id="col1" dataField="@section" width="100" />
                 <mx:AdvancedDataGridColumn dataField="@qty" width="120" textAlign="right" labelFunction="formatAsFraction"/>
                 <mx:AdvancedDataGridColumn dataField="@units" width="100" />
                 <mx:AdvancedDataGridColumn dataField="@caption"/>
            </mx:columns>
            <mx:rendererProviders>
                 <mx:AdvancedDataGridRendererProvider column="{col1}" columnSpan="2" dataField="@section" />
            </mx:rendererProviders>
            </mx:AdvancedDataGrid>
            

            But that gives me:

            http://grab.by/9uL

            Wrong.  Help!

            • 3. Re: Advanced Data Grid - grouping label column span?
              Sameer Bhatt Adobe Employee

              You need to provide a renderer in the RendererProvider.

               

              Here is another example -

              This will only set the first column with depth 1 to span the whole row.

               

              <mx:AdvancedDataGrid id="adg creationComplete="gc.refresh()">

                        <mx:dataProvider>

                             <mx:GroupingCollection id="gc" source="">

                                  <mx:Grouping label="name">

                                       <mx:GroupingField name="name" />

                                  </mx:Grouping>

                             </mx:GroupingCollection>

                        </mx:dataProvider>

                        <mx:columns>

                             <mx:AdvancedDataGridColumn id="col1" dataField="name" />

                             <mx:AdvancedDataGridColumn dataField="info" />

                        </mx:columns>

                        <mx:rendererProviders>

                             <mx:AdvancedDataGridRendererProvider dataField="name" depth="1" column="" columnSpan="0"

                                                                           renderer="mx.controls.advancedDataGridClasses.AdvancedDataGridGroupItemRenderer" />

                        </mx:rendererProviders>

                   </mx:AdvancedDataGrid>

               

              columnSpan = 0 means that the renderer will span the whole row.

              depth = 1 means that the renderer will be applied only for the rows with depth 1.

              renderer - here you need the AdvancedDataGridGroupItemRenderer to be used.

               

              -Sameer

              1 person found this helpful
              • 4. Re: Advanced Data Grid - grouping label column span?
                Handycam Level 1

                Thanks so much, it works now.