0 Replies Latest reply on Oct 6, 2009 2:43 PM by calebmei

    AdvancedDataGrid use of multiple item renderers (AdvancedDataGridRendererProvider)

    calebmei

      Hihi,

       

      I am able to use AdvancedDataGrid and AdvancedDataGridRendererProvider, such that when a user expand the tree to the 3rd level, it uses a custom renderer to display the information within the AdvancedDataGrid. Below is the code.

       

      I am wondering, if it is possible to display different item renderer base on the data, instead of the depth.

       

      For example, when the data is type A, use renderer A, and if data is type B, use renderer B. So the depth of the item is not a constant value.

       

      Perhaps I should override the expandItem() or setupRenderer() in AdvanceDataGrid, to feed in the custom itemRenderer?

       

      Thanks in advance. Really appreciate any feedback or comments.

       

      Cheers,

      Calebmei

       

       

            <mx:AdvancedDataGrid id="myADG" dataProvider="{new HierarchicalData(myData)}" variableRowHeight="true" width="100%" height="100%">
                      <mx:columns>
                           <mx:AdvancedDataGridColumn dataField="type" headerText="title"/>
                              <mx:AdvancedDataGridColumn dataField="name" headerText="description"/>
                              <mx:AdvancedDataGridColumn dataField="title" headerText="details"/>
                      </mx:columns>
                      <mx:rendererProviders>
                          <mx:AdvancedDataGridRendererProvider depth="3" columnIndex="1" renderer="myRenderer" columnSpan="0" />
                      </mx:rendererProviders>

                  </mx:AdvancedDataGrid>