简体   繁体   English

请解释为什么在datagrid列中使用itemrenderer和itemeditor组件时出现以下错误

[英]Please explain why i am getting the following error when I use itemrenderer and itemeditor components in the datagrid column

Code: 码:

<mx:DataGridColumn id="a" headerText="Notes" dataField="a" width="200" visible="true" editable="false" wordWrap="true" editorDataField="text">

<mx:itemRenderer>
    <mx:Component>
        <mx:HBox>
            <mx:Text width="100%" height="100%"/>
        </mx:HBox>
    </mx:Component>
</mx:itemRenderer>
<mx:itemEditor>
    <mx:Component>
        <mx:HBox>
            <renderers:EditorTextRenderer width="100%" />
        </mx:HBox>
    </mx:Component>
</mx:itemEditor> 

ErrorStackTrace: ReferenceError: Error #1069: Property text not found on a.mxml.a_inlineComponent3 and there is no default value. ErrorStackTrace:ReferenceError:错误#1069:在a.mxml.a_inlineComponent3上找不到属性文本,并且没有默认值。

I suppose, your custom component EditorTextRenderer should contain property text . 我想,您的自定义组件EditorTextRenderer应该包含属性text Or you must set editorDataField to that property, which is responsable for editing. 或者,您必须将editorDataField设置为该属性,该属性负责编辑。 For more details read this . 有关更多详细信息,请阅读此内容

A simple inline item editor contains a single control that supports the data property. 一个简单的内联项编辑器包含一个支持data属性的控件。 Flex automatically copies the current cell data to the item renderer or item editor, and copies the new cell data back to the list control based on the value of the editorDataField property Flex会自动将当前单元格数据复制到项目渲染器或项目编辑器,然后根据editorDataField属性的值将新的单元格数据复制回到列表控件

First, I don't recommend using inline item renderers/editors. 首先,我不建议使用内联项目渲染器/编辑器。 It makes for sloppy code and stops you from reusing the renderers elsewhere (which is kind of the whole point; also, if in separate files it would be easier to debug). 它会产生草率的代码,并阻止您在其他地方重用渲染器(这很重要;此外,如果在单独的文件中,调试起来会更容易)。 Second, I believe that problem lies in the EditorTextRenderer which probably already it's own renderer and doesn't support the 'text' attribute. 其次,我认为问题出在EditorTextRenderer ,它可能已经是它自己的渲染器,并且不支持'text'属性。 I think what you want to do is this: 我认为您要执行的操作是:

<mx:itemEditor>
<renderers:EditorTextRenderer width="100%" />
   </mx:itemEditor> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在数据网格的项目渲染器下使用的单选按钮中使用单选按钮组时,出现以下错误, - While using a radiobutton group in a radiobutton used under an itemrenderer of a datagrid, I am getting the following error, Datagrid使用ItemEditor值更新ItemRenderer - Datagrid update ItemRenderer with ItemEditor value 我可以在flex中为datagrid列创建多个itemrenderer吗? - Can i create multiple itemrenderer for a datagrid column in flex? 如何知道何时单击Flex DataGrid itemRenderer中的Button? - How can I know when a Button in a Flex DataGrid itemRenderer is clicked? 编辑单元格时,使用itemEditor“ combobox”伸缩可编辑数据网格不会自动滚动 - Flex editable datagrid with itemEditor “combobox” not auto scroll when I edit a cell ItemRenderer与ItemEditor - ItemRenderer Vs ItemEditor 滚动时MX数据网格的行中的itemRenderer发生更改 - itemRenderer is getting changed in the rows of a MX datagrid when scrolling ItemRenderer通过AdvancedDataGrid上的ItemEditor显示 - ItemRenderer shows through ItemEditor on AdvancedDataGrid 如何在Flex的Datagrid itemrenderer中选择特定的复选框? - how can i select particular checkbox within datagrid itemrenderer in flex? 我可以将多个ItemRenderer与一个LineSeries一起使用吗? - Can I use multiple ItemRenderer with one LineSeries?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM