2010-08-09 38 views
0

我正在爲我的DataGrid使用自定義itemEditor。 itemEditor具有一個簡單的TextField作爲組件。 但是,當我點擊單元格時,出現如下錯誤: ReferenceError:Error#1069:Property text not ed on editors.customItemEditor and there is no default value。 在爲mx.controls ::數據網格/ itemEditorItemEditEndHandler()[C:\自動構建\ 3.2.0 \框架\項目\框架的\ src \ MX \控件\ DataGrid.as:4827]Gettinf屬性** text **在DataGrid中未找到錯誤

PLZ幫我解決這個問題。

我的意見是錯誤是「文本」字段。但我沒有訪問「文本」字段或在我的代碼中的任何地方使用它。

問候, 拉維

回答

0

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

By default, Flex expects an item editor to return a single value to the list-based control. You use the editorDataField property of the list-based control to specify the property of the item editor that contains the new data. Flex converts the value to the appropriate data type for the cell.

The default item editor is a TextInput control. Therefore, the default value of the editorDataField property is "text", which corresponds to the text property of the TextInput control. If you specify a custom item editor, you also set the editorDataField property to the appropriate property of the item editor
0

我仍然襲擊了這個錯誤,但採取我認爲有走出它的希望...... :)

如果我們將TextInput作爲itemEditor,如:

dataGridColumn.itemEditor = new ClassFactory(TextInput); 

然後在TextInput.as內部定義「文本」時沒有問題。 在類似的筆記,如果我複製設置文本,並獲得我們的自定義編輯器中的文本,然後其工作正常..只有問題是 即將到來是關於提交更改的值。

我正在努力,希望我能夠把它整理出來。

PS:我這裏是新手,所以PLZ原諒我的任何愚蠢的RND的...:P

1

我解決了這個問題commiting incluting 「返回數據[」 選擇 「]到的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> 
相關問題