I got it working through your pointers. Thanks
--- In flexcoders@yahoogroups.com, Alex Harui <aha...@...> wrote: > > You may need to call super.listData > > > On 6/26/10 5:52 PM, "Rajan" <ilikef...@...> wrote: > > > > > > > > > I created itemeditor > > public class TextInputFieldEditor extends TextInput > { > private var _listData:BaseListData; > private var _dataGrid:CheckBoxDataGrid; > private var _dataField:String; > private var _columnIndex:int; > > public function TextInputFieldEditor() > { > addEventListener(FocusEvent.FOCUS_IN,onFocusIn,false,0,true); > super(); > } > > override public function get listData():BaseListData > { > return _listData; > } > > override public function set listData(value:BaseListData):void > { > _listData=value; > _dataGrid=value.owner as CheckBoxDataGrid; > _dataField=(value as DataGridListData).dataField; > _columnIndex = (value as DataGridListData).columnIndex; > } > > private function onFocusIn(event:Event):void > { > this.maxChars = (_dataGrid.columns[_columnIndex] as > CustomDataGridColumn).maxCharaters; > } > > but when i click on the datagrid to edit the field, the correct value is not > displayed in the cell. It shows [object ServicePlnVO]. Though itemrender > displays correct value. > > Any pointers. > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , > Alex Harui <aharui@> wrote: > > > > Editor is created after itemEditBegin. The recommended practice is to > > subclass the itemEditor. > > > > Maybe cheat by using focusIn event. > > > > > > On 6/24/10 12:36 PM, "ilikeflex" <ilikeflex@> wrote: > > > > > > > > > > > > > > Hi > > > > I have datagrid and i am using the default itemeditor. I want to limit the > > charatcres the user can enter. > > > > I have implemented itemEditBegin method on datagrid. > > > > private function onitemEditBegin(event:DataGridEvent):void > > { > > var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid); > > var customDataGridColumn:CustomDataGridColumn = > > datGrid.columns[event.columnIndex] as CustomDataGridColumn; > > var field:String=datGrid.columns[event.columnIndex].dataField; > > if(field == "prlName") > > { > > var editor:TextInput = datGrid.itemEditorInstance as TextInput; > > editor.maxChars = 5; > > } > > > > } > > > > I always get editor as null... so i am not able to set maxChars on > > TextInput. How to do this.. > > > > Any pointers. > > > > Thanks > > ilikeflex > > > > > > > > > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > > > > > > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui >