Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-30-2010, 10:06 PM   PM User | #1
bon_t
New Coder

 
Join Date: Jul 2010
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
bon_t is an unknown quantity at this point
Issue with dropdownlist in datagrid

I'm using Flex 4. I'm trying to embed a dropdownlist into a datagrid column. When I have the drop-down list on its own, the three "tag" values (i.e. ACCOUNTS, ENQUIRY, PLAN) appear as expected. However, when the drop-down list is embedded in the column, only the "tag" value for that row appears and the anchor arrow disappears. I want the user to be able to modify existing values in the drop-down list or to enter new values, hence I left the data column to be editable. I did try setting editable="false" but then no values at all would show up.

Thanks for your guidance!

Here are the relevant snippets of my code:

Code:
[Bindable]
private var samplesDG:ArrayCollection = new ArrayCollection([{"index":1,"count":44,"tag":"ACCOUNTS","fake":"false","audioFile":"C:\\Tagging_Station\\20070206000004\\chan 23-20070223161414.ulaw","comments":"","transcriptionError":"","transcr iption":"i'd like to dispute my current billing account"},{"index":2,"count":21,"tag":"ENQUIRY","fake":"true","audioFile":"C:\\Tagging_Station\\20070206000004\\chan2 3-20070227134917.ulaw","comments":"","transcriptionError":"","transcri ption":"customer service"},{"index":3,"count":37,"tag":"PLAN","fake":"false","audioFile":"C:\\Tagging_Station\\20070206000004\\chan 19-20070206081117.ulaw","comments":"","transcriptionError":"","transcr iption":"a phone plan"}]);
<!-- THIS IS THE DROPDOWNLIST ON ITS OWN (first attached picture) -->
Code:
<s:DropDownList x="338" y="280" dataProvider="{samplesDG}" labelField="tag"></s:DropDownList>
<!-- THIS IS THE DROPDOWNLIST IN THE COLUMN (second attached picture) -->
Code:
            <mx:DataGrid x="82" y="189" dataProvider="{samplesDG}" width="100%" height="100%" editable="true">
                <mx:columns>
                    <mx:DataGridColumn headerText="Tag" dataField="tag">
                        <mx:itemRenderer>
                            <fx:Component>
                                <s:MXDataGridItemRenderer>
                                    <s:DropDownList labelField="{data.tag}"/>
                                </s:MXDataGridItemRenderer>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
               </mx:columns>
            </mx:DataGrid>
Attached Thumbnails
Click image for larger version

Name:	dropdownlist_tags.JPG
Views:	246
Size:	3.4 KB
ID:	8749   Click image for larger version

Name:	dropdownlist_tags_in_column.JPG
Views:	271
Size:	4.3 KB
ID:	8750  
bon_t is offline   Reply With Quote
Old 08-03-2010, 07:19 AM   PM User | #2
hedberg.fi
New to the CF scene

 
Join Date: Aug 2010
Location: Inkoo, Finland
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
hedberg.fi is an unknown quantity at this point
Try to create a proper itemrenderer with File->New->MXML ItemRenderer.

Then remove the default Label in the new itemrenderer and add a dropdownlist which you then can populate with the right data, and add event handling functions to if needed. Check the documentation, you'll get good info there.
hedberg.fi is offline   Reply With Quote
Old 08-03-2010, 02:39 PM   PM User | #3
bon_t
New Coder

 
Join Date: Jul 2010
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
bon_t is an unknown quantity at this point
Thank you for your reply, hedberg.fi.

I did create a custom itemRenderer specifically for the MX DataGrid:

Code:
<?xml version="1.0" encoding="utf-8"?>
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
						  xmlns:s="library://ns.adobe.com/flex/spark" 
						  xmlns:mx="library://ns.adobe.com/flex/mx" 
						  focusEnabled="true">
	<!-- s:Label id="lblData" top="0" left="0" right="0" bottom="0" text="{dataGridListData.label}"/ -->
	<s:DropDownList labelField="{data.tag}"/>
</s:MXDataGridItemRenderer>
It gave me the same results as before.

It seems that, since the dropdownlist is embedded in a datagrid column, I have to provide it with a separate list of just these tag values. The same thing happens with a combobox.

Any other ideas/thoughts?
bon_t is offline   Reply With Quote
Old 10-12-2011, 09:18 AM   PM User | #4
dilsy88
New to the CF scene

 
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dilsy88 is an unknown quantity at this point
Did that did the trick
Try going through this article at:-
http://www.4guysfromrolla.com/webtech/050801-1.shtml
Hope that helps
dilsy88 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 PM.


Advertisement
Log in to turn off these ads.