簡體   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