component1 <?xml version="1.0" encoding="utf-8"?> <mx:TextInput xmlns:mx="http://www.adobe.com/2006/mxml" restrict="0-9"> </mx:TextInput>
component2 <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import mx.collections.*; import flash.events.Event; import mx.controls.DataGrid; override public function set data(value:Object):void { if(value != null) { super.data = value; cb.selectedItem=data.selected; } } public function changeHandler(event:Event):void { trace(String(cb.selectedItem)) data.selected=String(cb.selectedItem); IList(DataGrid(owner).dataProvider).itemUpdated(cb.selectedItem); } </mx:Script> <mx:ComboBox id="cb" creationComplete="cb.selectedItem = data.selected" textAlign="left" change="changeHandler(event)" dataProvider="{data.arr}"> </mx:ComboBox> </mx:Canvas> main <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; private function test():void { Alert.show(dg.selectedItem.count +' '+dg.selectedItem.selected); } [Bindable] public var dp:ArrayCollection = new ArrayCollection([{count: 1,selected:123,arr:[123,456]}]); ]]> </mx:Script> <mx:DataGrid id="dg" width="100%" height="100%" dataProvider="{dp}" editable="true"> <mx:columns> <mx:DataGridColumn headerText="Count" dataField="count" itemRenderer="comp.ItemRend" editable="true" rendererIsEditor="true"> </mx:DataGridColumn> <mx:DataGridColumn headerText="combo" dataField="selected" editable="false" itemRenderer="comp.ItemRend2"> </mx:DataGridColumn> </mx:columns> </mx:DataGrid> <mx:Button click="test()"/> </mx:Application> On Oct 10, 10:23 am, AAFShini <[EMAIL PROTECTED]> wrote: > Thanks for the answer, I have 2 questions for that: > 1- Can I validate the input of the user if I specify TextInput in > itemRenderer? > 2- What about DropBox? > > AFShin > > On Oct 9, 11:12 pm, ashok <[EMAIL PROTECTED]> wrote: > > > You can directly give the TextInput as ItemRenderer, you'll get the > > solution. > > > On Oct 9, 10:09 pm, AAFShini <[EMAIL PROTECTED]> wrote: > > > > HI, > > > I have a DataGrid, that has lets say 2 columns, each column is in a > > > seperate mxml file and used in itemRenderer. > > > How can I get the data that the user has entered in those column when > > > I hit Submit button. > > > Examples: > > > component1: > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" > > > horizontalScrollPolicy="off"> > > > <mx:Script> > > > <![CDATA[ > > > [Bindable] > > > public var text:String; > > > ]]> > > > </mx:Script> > > > > <mx:TextInput id="rate" restrict="0-9 ." maxChars="7" text="0.02" > > > toolTip="Please enter the rate" /> > > > </mx:Canvas> > > > > Component2: > > > Samething but with ComboBox > > > > DataGrid is Actually in a Component and the Mail Application uses it > > > in a ViewStack. > > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" textAlign="center" > > > height="{dg.height+76}"> > > > <mx:VBox> > > > <mx:Script> > > > <![CDATA[ > > > import mx.collections.ArrayCollection; > > > [Bindable] > > > private var sData:ArrayCollection = new > > > ArrayCollection([{count:"1"}, {count:"2"}, {count:"3"}]); > > > ]]> > > > </mx:Script> > > > <mx:DataGrid editable="true" id="dg" dataProvider="{sData}" > > > width="1100" > > > > <mx:columns> > > > <mx:DataGridColumn headerText="Rate" > > > rendererIsEditor="true" > > > itemRenderer="component1"/> > > > <mx:DataGridColumn headerText="comp2" > > > rendererIsEditor="true" > > > itemRenderer="component2"/> > > > </mx:columns> > > > </mx:DataGrid> > > > > </mx:VBox> > > > <mx:Button label="Submit" click="getData()"/> > > > </mx:Panel> > > > > Is this possible? > > > or I should do it in itemEndEditor event and gather data then. > > > > PLease Help, > > > > AFShin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

