[英]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.