Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Flex component initialization problem

Former Member
0 Likes
798

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.

6 REPLIES 6
Read only

Former Member
0 Likes
749

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

Read only

0 Likes
749

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..

Read only

0 Likes
749

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

Read only

0 Likes
749

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

Read only

0 Likes
749

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

Read only

Former Member
0 Likes
749

Why using comboboxes ?

Why don't you use listboxes ? Than you can drag and drop !