在AdvanceDataGrid中添加记录时:TypeError:错误#1010:术语未定义且没有属性

问题描述 投票:-1回答:1

TypeError:错误#1010:术语未定义且没有属性。

我在flex中有一个可编辑的AdvancedDataGrid:

<mx:AdvancedDataGrid id="dgTrans" dataProvider="{arrDtlTransDP}" styleName="advancedDataGrid" left="5" right="50"
    doubleClickEnabled="true" itemDoubleClick="fn_EditFieldDetail(event);" maxWidth="850"
    editable="true" top="27" rowHeight="20" verticalAlign="middle" resizableColumns="true"  
    allowMultipleSelection="true" allowDragSelection="true"
    horizontalScrollPolicy="auto" height="460">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="S No." dataField="rrd_Trans_No" labelFunction="fn_GetSNo" width="100" editable="false"/>
    <mx:AdvancedDataGridColumn headerText="Monthly Amount" dataField="rrd_Amount" width="110" labelFunction="fn_FormatAmountGrid"/>
    <mx:AdvancedDataGridColumn headerText="Effective From" dataField="rrd_Effective_From" width="100" rendererIsEditor="true"
        labelFunction="fn_FormateDate" itemRenderer="mx.controls.DateField" editorDataField="selectedDate"/>
    <mx:AdvancedDataGridColumn headerText="Narration" dataField="rrd_Narration" width="150" editable="true"/>
    <mx:AdvancedDataGridColumn headerText="Rental Income a/c" dataField="rrd_Acc_Code" id="rrd_Acc_Code" width="120" labelFunction="fn_FormatCOAGrid"/>
</mx:AdvancedDataGridColumn>
<mx:AdvancedDataGridColumn headerText="Description" dataField="rrd_Acc_Desc" id="rrd_Acc_Des" width="120" editable="false"/>

我在新的情况下添加了以下虚拟数据

var dgArray:Array = [{
    rrd_Trans_No:'1', rrd_Amount:'0.00',
    rrd_Effective_From: new Date(2016,0,1),
    rrd_Narration:'abc', rrd_Acc_Code:'0001',
    rrd_Acc_Desc:'acd'
}];

arrDtlTransDP.addItem(dgArray);

当我点击任何列来编辑这个虚拟数据时,我面临一个错误。

TypeError:错误#1010:术语未定义且没有属性

actionscript-3 flash flex actionscript flash-builder
1个回答
0
投票

首先,您使用数组填充arrDtlTransDP。立即将项添加到arrDtlTransDP,跳过dgArray。

像这样:

arrDtlTransDP = new ArrayCollection();
arrDtlTransDP.addItem({
    rrd_Trans_No:'1', rrd_Amount:'0.00', 
    rrd_Effective_From: new Date(2016,0,1), 
    rrd_Narration:'abc', rrd_Acc_Code:'0001', 
    rrd_Acc_Desc:'acd'});

其次,我们需要有关函数实现的更多信息,以正确地告诉您可能存在的问题。

我添加了这些实现,并且我的上述更改没有错误:

    protected function fn_FormatAmountGrid(item:Object, column:AdvancedDataGridColumn):String {
        return item.rrd_Amount;
    }

    protected function fn_FormatCOAGrid(item:Object, column:AdvancedDataGridColumn):String {
        return item.rrd_Acc_Code;
    }

    protected function fn_FormateDate(item:Object, column:AdvancedDataGridColumn):String {
        return item.rrd_Effective_From;
    }

    protected function fn_GetSNo(item:Object, column:AdvancedDataGridColumn):String {
        return item.rrd_Trans_No;
    }

    protected function fn_EditFieldDetail(event:ListEvent):void {
        // TODO Auto-generated method stub

    }

我希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.