ownerdata is a variable that is set to the DG's row data. *ownerData = value as XML;* ** get's the row data. sorry i should have commented it more
On 12/21/07, mark goldin <[EMAIL PROTECTED]> wrote: > > Not sure I understand about ownerData. Is it a hard coded dataProvider > name for DG? I am working on a generic solution, I can't use hard coded > names. Sorry, if I am misunderstanding your solution. > > *Dominique Bessette - Halsema <[EMAIL PROTECTED]>* wrote: > > Here is the code for the itemRenderer for a combobox i made. The > dataProvider is xml. > > > <?xml version="1.0" encoding="utf-8"?> > <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" > rowCount="2" labelField="@name" dataProvider="{weemcStatus}" > change="onSelectionChange(event)"> > <mx:Script> > <![CDATA[ > import mx.events.ListEvent; > import mx.controls.dataGridClasses.DataGridListData; > import mx.collections.XMLListCollection; > > private var ownerData:XML; > > //binds the xml row data to the combobox and appends the > weemcStatus > override public function set data(value:Object):void > { > if(value){ > ownerData = value as XML; > if(ownerData.weemcStatus.toString() == "" || > ownerData.weemcStatus.toString () == null){ > var item:XML = <weemcStatus>WILCO</weemcStatus>; > ownerData.appendChild(item.toXMLString()); > > } > } > } > > override public function get data():Object > { > return ownerData; > } > > override public function setFocus():void > { > super.setFocus(); > > open(); > } > > //get's the new status and changes the xml status value > private function onSelectionChange(e:ListEvent):void > { > if(selectedItem && ownerData){ > var col:DataGridListData = DataGridListData(listData); > var sname:String = selectedItem.toString (); > if(ownerData.weemcStatus.toString() != "" || > ownerData.weemcStatus.toString() != null){ > ownerData.weemcStatus = sname; > } > else{ > var item:XML = <weemcStatus>{sname}</weemcStatus>; > ownerData.appendChild(item.toXMLString()); > } > } > } > > > private var xmlStatus:XML = > <weemc> > <status>WILCO</status> > <status>CANTCO</status> > </weemc>; > > [Bindable] > private var weemcStatus:Array = (new XMLListCollection( > xmlStatus.status)).toArray(); > ]]> > </mx:Script> > </mx:ComboBox> > > > On 12/20/07, mark goldin <[EMAIL PROTECTED]> wrote: > > > > I am using a Combobox as an itemRenderer for one of columns in a DG. > > I have managed to intercept "change" event of the combobox. But what do I do > > to store new value from Combo into DG's dataProvider for the following data > > save to the server? > > What is an actual design pattern for that? > > > > Thanks much for help. > > > > > >

