No, no need, use default DataGridColumn with editable=true.

Each time when you editing, itemEditorInstance is actually a TextInput 
instance, set restrict patterns on that instance directly. (Usually 
different columns you have to set different restrict, that's why 
e.columnIndex used here.)

George

mark goldin wrote:
> 
> 
> Am I adding this code to my textItemRenderer?
> 
> */George <[EMAIL PROTECTED]>/* wrote:
> 
>     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]
>     <mailto:graham%40contrast-software.com>>/* wrote:
>      >
>      > --- In [email protected]
>     <mailto:flexcoders%40yahoogroups.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
>      >
>     

Reply via email to