0

I know this one might be easy but I couldn't figure out.

I have a List control that retrieve multiply data from Mysql. When a use clicks the data on List, The datagrid will display the data and the product image will show.

I can see the multiply data shown in my dataGrid, but I don't know how to get the individual data shown. I am not sure if I explain the questoin well. Please see the code below and thanks for any reply.

<s:List id="compList"
width="250"
height="350"
creationComplete="compList_creationCompleteHandler(event)"
itemRenderer="itemRenderer.compListItemRenderer"
change="compList_changeHandler(event)"  //when a user select a row, the datagrid will display the data.
>
<s:AsyncListView list="{compinfoResult.lastResult}"/>

</s:List>




<mx:DataGrid id="dataGrid" dataProvider="{compDetailinfoResult.lastResult}">      //The dataGrid display the data fine
<mx:columns>
<mx:DataGridColumn dataField="user" headerText="User"/>
<mx:DataGridColumn dataField="brand" headerText="Brand"/>
<mx:DataGridColumn dataField="compModel" headerText="Model"/>
<mx:DataGridColumn dataField="picture" headerText="Product Picture"/>
</mx:columns>
</mx:DataGrid>


<mx:Image source="??????" />   // I want to display productPicture here too but not sure what to add here.....

1 Answer 1

2

Try Something like this:

<mx:Image source="{dataGrid.selectedItem.sourcelocation}" />

It would be easier to be more specific if you had a running sample and/or an explanation of the value objects that make up your list. Your approach seems odd to me; as it appears you are using a DataGrid to display a single item. Is that correct? DataGrids are good for displaying multiple, similar, items in a table like format; I'm not sure if I'd use it for a single item.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the reply. I think I didn't explain the question well. I want the user to click the List control data and display the product details on both datagrid and the image control. I do have multiply items displayed in my dataGrid (see code above). Your code is for the user that clicks on the datagrid data instead of List. I appreciate the help though.
Never mind. I think I got it now. My question wasn't that clear. +1 and accepted answer for u.
I hope I helped. I don't understand what it means to multiple items. BTW, my code has nothing to do w/ clicking the DataGrid. Clicking is only one way to select items on a DataGrid [or List] Thanks for the rep, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.