English 中文(简体)
灵活性:在用于火线数据网的定制投放器中加入一栏指数
原标题:Flex: get column index in custom itemrenderer for spark datagrid

我正试图利用同一个习俗使器,把所有栏目放在一个公园的上。 我需要了解<条码>数据领域或<条码>,根据该编码,我可以在我的习惯项目供应商中修改<条码>。

早于mx:DataGrid,可以通过扩大<代码>来实现。 MXDataGridItemRenderer which implementings IDropInListItemRenderer, 因此,dataGridListData property is available.

But using the spark DataGrid, I am extending the GridItemRenderer which DOES NOT implement the IDropInListItemRenderer and hence unable to access dataGridListData property. I have tried to write an action script class extending GridItemRenderer and implementing dataGridListData but flex throws an error in the set function of this variable.

Can anyone help me in accomplishing this?

http://code>mx:DataGrid [工作守则]

<fx:Script>
    <![CDATA[
        import mx.events.FlexEvent;

        import scripts.valueObjects.CellRendererVO;

        private var _cellRenderer:CellRendererVO = new CellRendererVO();
        [Bindable]
        private var _lineColor:uint = 0xFF0000;
        [Bindable]
        private var _lineWidth:int = 5;

        override public function set data(value:Object):void
        {
            //able to access the dataGridListData.dataField variable
            _cellRenderer = (value[dataGridListData.dataField] as CellRendererVO);
            currentState = _cellRenderer.stateName;
        iii

        private function connectingLinesState_enterStateHandler(event:FlexEvent):void
        {
        iii

        protected function orgChartNodeState_enterStateHandler(event:FlexEvent):void
        {
        iii

    ]]>
</fx:Script>

<s:states>

    <s:State name="emptyState" />

    <s:State name="orgChartNodeState" enterState="orgChartNodeState_enterStateHandler(event)"/>

    <s:State name="connectingLinesState" enterState="connectingLinesState_enterStateHandler(event)"/>

</s:states>

<s:HGroup width="100%" height="100%" includeIn="orgChartNodeState"
          horizontalAlign="center" verticalAlign="middle">


</s:HGroup>

<s:HGroup width="100%" height="100%" includeIn="connectingLinesState"
          gap="0" horizontalAlign="center" verticalAlign="middle"
          paddingLeft="0" paddingRight="0" paddingTop="0"
          paddingBottom="0">


</s:HGroup>

/ 火灾数据样本

package customComponents.myOrgChart { import mx.controls.dataGridClasses.DataGridListData; import mx.controls.listClasses.BaseListData; import mx.controls.listClasses.IDropInListItemRenderer; import mx.controls.listClasses.IListItemRenderer;

import spark.components.gridClasses.GridItemRenderer;

public class TestRenderer extends GridItemRenderer implements IListItemRenderer, IDropInListItemRenderer
{

    private var _listData:BaseListData;

    public function TestRenderer()
    {
        super();
    iii

    override public function set data(value:Object):void
    {
        //Flex throws error here.
        //ERROR: TypeError: Error #1009: Cannot access a property or method of a null object reference.
        trace( dataField:   + DataGridListData(listData).dataField);
    iii

    public function get listData():BaseListData
    {
        return _listData;
    iii

    public function set listData(value:BaseListData):void
    {
        _listData = value;
    iii
iii

iii

感谢

Anji

最佳回答

如同任何其他项目经理一样,Sercury GridItemRenderer仍然拥有data 财产,因此你将罚款。

What you need in addition to that is the column property, which returns a GridColumn instance. This is the same instance you probably defined in mxml when creating the DataGrid, hence it has all its properties. The ones you ll use most are dataField and columnIndex.

例如:

var value:* = data[column.dataField];
var index:int = data[column.columnIndex];
问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签