0

我正在为我的 DataGrid 使用自定义 itemEditor。itemEditor 有一个简单的 TextField 作为组件。但是,当我单击单元格时,我会收到错误消息:ReferenceError: Error #1069: Property text not found on editors.customItemEditor 并且没有默认值。在 mx.controls::DataGrid/itemEditorItemEditEndHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:4827]

请帮我解决这个问题。

我的意见是“文本”字段出现错误。但我没有访问“文本”字段或在我的代码中的任何地方使用它。

问候,拉维

4

3 回答 3

1

我解决了将“return data["selected"].toString()" 包含到获取文本中的问题:

    <mx:DataGridColumn dataField="selected" rendererIsEditor="true" >
            <mx:itemRenderer> 
                <fx:Component>
                    <mx:Box styleName="" width="100%" height="100%" backgroundAlpha="0.0"
                            horizontalAlign="center" verticalAlign="middle">

                        <fx:Script>
                            <![CDATA[

                                public function get text():String
                                {
                                    return data["selected"].toString();
                                }
                                public function set text(value:String):void
                                {

                                }
                                protected function checkbox1_clickHandler(event:MouseEvent):void
                                {
                                    data["selected"]=event.target["selected"];
                                }
                            ]]>
                        </fx:Script>

                        <mx:CheckBox selected="{data.selected}" click="checkbox1_clickHandler(event)"/>
                    </mx:Box>
                </fx:Component>
            </mx:itemRenderer>              
        </mx:DataGridColumn>
于 2013-12-25T08:07:24.977 回答
0

我仍然被这个错误所困扰,但我认为有希望摆脱它.... :)

如果我们将 TextInput 作为 itemEditor,比如:

dataGridColumn.itemEditor = new ClassFactory(TextInput);

然后没有问题,因为“文本”是在 TextInput.as 内部定义的。在类似的注释中,如果我复制设置文本并在我们的自定义编辑器中获取文本,那么它工作正常..唯一的问题是关于提交更改的值。

我正在处理它,希望我能解决它。

PS:我是这里的新手,所以请原谅我任何愚蠢的 RnD ...:p

于 2010-08-09T09:03:12.203 回答
0

取自http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_8.html

默认情况下,Flex 期望项目编辑器向基于列表的控件返回单个值。您使用基于列表的控件的 editorDataField 属性来指定包含新数据的项目编辑器的属性。Flex 将值转换为单元格的适当数据类型。

默认项目编辑器是 TextInput 控件。因此,editorDataField属性的默认值为“text”,对应TextInput控件的text属性。如果您指定自定义项目编辑器,您还将 editorDataField 属性设置为项目编辑器的相应属性
于 2010-08-09T06:27:09.760 回答