开发者

Gettinf Property **text** not found error in DataGrid

I am using a custom itemEditor for my DataGrid. The itemEditor has a simple TextField as a component. But when ever i am clicking the cell i am getting an error as : ReferenceError: Error #1069: Property text not found on editors.customItemEditor and there is no default value. at mx.controls开发者_高级运维::DataGrid/itemEditorItemEditEndHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:4827]

Plz help me to resolve this issue.

My Opinion is that the error is coming for the "text" field. But i havn't accessed "text" field or used it anywhere in my code.

Regards, Ravi


i solved the problem with commiting incluting "return data["selected"].toString()" into get text:

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


Taken from 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


I am still Struck in this error but i think there is a hope of coming out of it.... :)

If we take TextInput as the itemEditor, like:

dataGridColumn.itemEditor = new ClassFactory(TextInput);

Then there was no problem as "text" is being internally defined inside TextInput.as. On a similar note if i copy set text and get text inside our custom Editor, then its working fine.. only problem that is coming is regarding commiting the changed values.

I am working on it, hope i'll be able to sort it out.

P.S.: I am a newbie here, so plz pardon me of any idiotic RnD... :p

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜