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

1.6k views Asked by At

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

3

There are 3 answers

0
Oleg Rudnev On

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>
0
2DH On

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
0
Ravi Ranjan On

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