‎2009 Sep 18 5:42 AM
Hi All,
I am developing flex application,in that :
There is one datagrid in which one of the columns contains ComboBox in each row.This combobox i am accessing as item rendrerer.Now the problem is when i select one of the values from combobox it shows in that datagrid but while passing it to another datagrid ,doesnot pass the selected value.
please help.
Thank you.
Prajakta.
‎2009 Sep 18 6:21 AM
Hi Prajakta,
In case you need to copy some item entries from 1 Datagrid to another, you can push those copy into an array or arraycollection and then pass this as an dataprovider to second datagrid.
this may come as :
CheckArrayColl.addItem({Col1:dg1_id.selectedItem.field1,Col2:dg1_id.selectedItem.field2});
dg2_id.dataProvider = CheckArrayColl;Note : Be sure about field names mapping or it will not copy data correctly. Dataprovider and Datagrid columns should have same names in dataField.
OR
You can go with Drag and Drop method also. refer following link for example :
http://blog.flexexamples.com/2007/09/19/dragging-rows-between-two-different-flex-datagrid-controls/
Hope this will help you.
Regards,
Vivek
‎2009 Sep 18 6:53 AM
Hi Vivek,
Actually the problem is i am using combobx in one of the columns.So it doesn;t take selected value in combobox,on row selection of datagrid.
Thanks
Prajakta..
‎2009 Sep 18 7:10 AM
Hi Prajakta,
Rendered component won't make major effect on datagrid selected item text property.
Still if you can post those code snippets then may be i can get more clear idea.
Regards,
Vivek
‎2009 Sep 18 7:50 AM
Hi Vivek,
<mx:DataGrid width="100%" itemClick="selectRow()" selectable="true" rowHeight="40" height="100%" y="60" id="dgData" dataProvider="" fontSize="13">
<mx:columns>
<mx:DataGridColumn headerText="Assembly" dataField="MATNR"/>
<mx:DataGridColumn headerText="Assembly Details" dataField="MAKTX"/>
<mx:DataGridColumn headerText="Base unit of Measure" dataField="MEINS"/>
<mx:DataGridColumn headerText="Quantity" dataField="val" itemRenderer="hcombo">
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
hcombo is:
<mx:ComboBox id="combo" change="getItem(event)" width="140" height="36" textAlign="left" dataProvider="" />
<mx:Script>
<![CDATA[
public function getItem(event:Event):void
{
strcombo = combo.selectedItem.data;
Alert.show(""+strcombo);
}
]]>
</mx:Script>
Here data to datagrid is coming from r/3 by calling webservice.and hcombo is the custom component that i am using as comboBox.
now on change of combobox selection its value should reflect in grid.how to do this.
One more thing ,i have set datagrid multiselection property to true.Now on every row select i want change the color of that row.
is it possible?
Thanks
Prajakta
‎2009 Sep 18 8:38 AM
Hi Prajakta,
Try with ItemEditor instead of itemRenderer in your code.
If other things are ok like field mapping and all then this should work for you.
for second question ans is :
Just assign any hex value of any color to selectionColor property of datagrid.
<mx:DataGrid selectionColor="#808080"/>Regards,
Vivek
‎2009 Sep 20 7:27 PM
Why using comboboxes ?
Why don't you use listboxes ? Than you can drag and drop !