Add restrict after itemEditBegin event. itemEditBegin="this.itemEditBeginHandler(event)"
private function itemEditBeginHandler(e:DataGridEvent):void { // add restrict for text input cells this.callLater(restrictCells, [e.columnIndex]); } private function restrictCells(columnIndex:int):void { if(this.listGrid.itemEditorInstance == null){ return; } var textInput:TextInput; ... } George mark goldin wrote: > > > The thing is I am adding itemRenderers to the DataGrid later in my code: > * * > * * > * * > *var* > ConsistPersonnel1Worknum:ClassFactory = *new* > ClassFactory(textItemRenderer); > *var* consistPersonnel1Worknum:AdvancedDataGridColumn = > Personnel1Grid.columns[2]; > consistPersonnel1Worknum.itemRenderer = ConsistPersonnel1Worknum; > > where textItemRenderer: > * * > *public* > *class* textItemRenderer *extends* TextInput > { > *public* *function* textItemRenderer() > { > ...... > > I have tried to add restrict property in different places of my code, > but it did not work. > > > */candysmate <[EMAIL PROTECTED]>/* wrote: > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com>, "markgoldin_2000" > <[EMAIL PROTECTED]> wrote: > > > > Any sample of using restrict property for fields in DataGrid? > > > > Thanks > > > > Mark, > > I use this withim my current project: > > <mx:DataGridColumn > headerText="RRP (p)" > dataField="retail" > width="60" > textAlign="right" > rendererIsEditor="true" > > > <mx:itemRenderer> > <mx:Component> > <mx:TextInput restrict="0-9"> > </mx:TextInput> > </mx:Component> > </mx:itemRenderer> > </mx:DataGridColumn> > > HTH > > best, Graham > >