Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
AdvancedDataGridRendererProvider

Package | mx.controls.advancedDataGridClasses
Class | public class AdvancedDataGridRendererProvider
Inheritance | AdvancedDataGridRendererProvider Object
Implements | IAdvancedDataGridRendererProvider

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

An AdvancedDataGridRendererProvider instance defines the characteristics for a single item renderer used by the AdvancedDataGrid control. Use properties of the AdvancedDataGridRendererProvider class to configure where an item renderer is used in an AdvancedDataGrid control.

The following example uses the AdvancedDataGridRendererProvider class to configure a custom item renderer named EstimateRenderer.mxml in the myComponents subdirectory.

      <mx:AdvancedDataGrid>
          <mx:columns>
              <mx:AdvancedDataGridColumn dataField="Region"/>
              <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                  headerText="Territory Rep"/>
              <mx:AdvancedDataGridColumn dataField="Actual"/>
              <mx:AdvancedDataGridColumn dataField="Estimate"/>
          </mx:columns>

          <mx:rendererProviders>
              <mx:AdvancedDataGridRendererProvider
                  columnIndex="3"
                  columnSpan="1"
                  renderer="myComponents.EstimateRenderer"/>
          </mx:rendererProviders>
      </mx:AdvancedDataGrid>

MXML Syntax Show MXML Syntax
Hide MXML Syntax

The `<mx:AdvancedDataGridRendererProvider>` tag defines the following tag attributes:

      <mx:AdvancedDataGridRendererProvider
        Properties
        column="Not defined"
        columnIndex="-1"
        columnSpan="1"
        dataField="No default"
        depth="All depths of the tree"
        renderer="null"
        rowSpan="1"
      />

View the examples

See also

mx.controls.AdvancedDataGrid

Public Properties

| Property | Defined By
--- | --- | ---
|  | column : AdvancedDataGridColumn The id of the column for which the renderer is used. | AdvancedDataGridRendererProvider
|  | columnIndex : int = -1 The column index for which the renderer is used, where the first column is at an index of 0. | AdvancedDataGridRendererProvider
|  | columnSpan : int = 1 Specifies how many columns the renderer should span. | AdvancedDataGridRendererProvider
|  | dataField : String The data field in the data provider for the renderer. | AdvancedDataGridRendererProvider
|  | depth : int = -1 Depth in the tree at which the renderer is used, where the top-most node of the tree is at a depth of 1. | AdvancedDataGridRendererProvider
|  | renderer : IFactory The ItemRenderer IFactory used to create an instance of the item renderer. | AdvancedDataGridRendererProvider
|  | rowSpan : int = 1 Specifies how many rows the renderer should span. | AdvancedDataGridRendererProvider

Public Methods

| Method | Defined By
--- | --- | ---
|  | AdvancedDataGridRendererProvider() Constructor. | AdvancedDataGridRendererProvider
|  | describeRendererForItem(data:Object, dataDepth:int, column:AdvancedDataGridColumn, description:AdvancedDataGridRendererDescription):void Updates the AdvancedDataGridRendererDescription instance with information about this AdvancedDataGridRendererProvider instance. | AdvancedDataGridRendererProvider

Property Detail

column | property

`public var column:AdvancedDataGridColumn`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The `id` of the column for which the renderer is used. If you omit this property, you can use the `columnIndex` property to specify the column.

columnIndex | property |

`public var columnIndex:int = -1`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The column index for which the renderer is used, where the first column is at an index of 0.

The default value is `-1`.

columnSpan | property |

`public var columnSpan:int = 1`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Specifies how many columns the renderer should span. Set this property to 0 to span all columns. The AdvancedDataGrid control uses this information to set the width of the item renderer.

The default value is `1`.

dataField | property |

`public var dataField:String`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The data field in the data provider for the renderer. This property is optional.

depth | property |

`public var depth:int = -1`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Depth in the tree at which the renderer is used, where the top-most node of the tree is at a depth of 1. Use this property if the renderer should only be used when the tree is expanded to a certain depth, but not for all nodes in the tree. By default, the control uses the renderer for all levels of the tree.

renderer | property |

`public var renderer:IFactory`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The ItemRenderer IFactory used to create an instance of the item renderer.

rowSpan | property |

`public var rowSpan:int = 1`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Specifies how many rows the renderer should span. The AdvancedDataGrid control uses this information to set the height of the renderer.

Currently, this property is not implemented in the AdvancedDataGrid control.

The default value is `1`.

Constructor Detail

AdvancedDataGridRendererProvider | () | Constructor

`public function AdvancedDataGridRendererProvider()`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Constructor.

Method Detail

describeRendererForItem | () | method

`public function describeRendererForItem(data:Object, dataDepth:int, column:AdvancedDataGridColumn, description:AdvancedDataGridRendererDescription):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Updates the AdvancedDataGridRendererDescription instance with information about this AdvancedDataGridRendererProvider instance.

Parameters

| `data:Object` — The data item to display.
| `dataDepth:int` — The depth of the data item in the AdvancedDataGrid control.
| `column:AdvancedDataGridColumn` — The column associated with the item.
| `description:AdvancedDataGridRendererDescription` — The AdvancedDataGridRendererDescription object populated with the renderer and column span information.

Examples
AdvancedDataGridChartRendererExample.mxml

    <?xml version="1.0"?>
    <!--

      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    -->
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">

      <fx:Script>
        <![CDATA[
          import mx.collections.ArrayCollection;

          [Bindable]
          private var dpHierarchy:ArrayCollection= new ArrayCollection([
            {name:"Barbara Jennings", region: "Arizona", total:70, children:[
              {detail:[{amount:5},{amount:10},{amount:20},{amount:45}]}]},
            {name:"Dana Binn", region: "Arizona", total:130,  children:[
              {detail:[{amount:15},{amount:25},{amount:35},{amount:55}]}]},
            {name:"Joe Smith", region: "California", total:229,  children:[
              {detail:[{amount:26},{amount:32},{amount:73},{amount:123}]}]},
            {name:"Alice Treu", region: "California", total:230, children:[
              {detail:[{amount:159},{amount:235},{amount:135},{amount:155}]}
            ]}
          ]);
        ]]>
      </fx:Script>

        <mx:Panel title="OLAPCube Control Example"
            height="75%" width="75%" layout="horizontal"
            paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

          <mx:AdvancedDataGrid id="myADG"
              width="100%" height="100%"
              variableRowHeight="true">
              <mx:dataProvider>
                 <mx:HierarchicalData source="{dpHierarchy}"/>
              </mx:dataProvider>
              <mx:columns>
                  <mx:AdvancedDataGridColumn dataField="name" headerText="Name"/>
                  <mx:AdvancedDataGridColumn dataField="total" headerText="Total"/>
              </mx:columns>

              <mx:rendererProviders>
                  <mx:AdvancedDataGridRendererProvider
                      dataField="detail"
                      renderer="ChartRenderer"
                      columnIndex="0"
                      columnSpan="0"/>
              </mx:rendererProviders>
            </mx:AdvancedDataGrid>
        </mx:Panel>

    </s:Application>

ChartRenderer.mxml

    <?xml version="1.0"?>
    <!--

      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    -->
    <!-- dpcontrols/adg/myComponents/ChartRenderer.mxml -->
    <mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        height="200" width="100%" >
        <mx:PieChart dataProvider="{data.detail}"
            width="100%"
            height="100%"
            showDataTips="true">
            <mx:series>
                <mx:PieSeries labelPosition="callout" field="amount"  />
            </mx:series>
        </mx:PieChart>
    </mx:VBox>

Wed Nov 15 2017, 09:50 AM +01:00