繁体   English   中英

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

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

码:

<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:错误#1069:在a.mxml.a_inlineComponent3上找不到属性文本,并且没有默认值。

我想,您的自定义组件EditorTextRenderer应该包含属性text 或者,您必须将editorDataField设置为该属性,该属性负责编辑。 有关更多详细信息,请阅读此内容

一个简单的内联项编辑器包含一个支持data属性的控件。 Flex会自动将当前单元格数据复制到项目渲染器或项目编辑器,然后根据editorDataField属性的值将新的单元格数据复制回到列表控件

首先,我不建议使用内联项目渲染器/编辑器。 它会产生草率的代码,并阻止您在其他地方重用渲染器(这很重要;此外,如果在单独的文件中,调试起来会更容易)。 其次,我认为问题出在EditorTextRenderer ,它可能已经是它自己的渲染器,并且不支持'text'属性。 我认为您要执行的操作是:

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

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM