Since your dataProvider has values of ‘b’, “i” and ‘e”, then, your ComboBox dataProvider should also have these values:

<mx:ComboBox labelFunction=’outerDocument.myLabelFunction“>
 <mx:dataProvider>
 <mx:String> b</mx:String>
 <mx:String> i</mx:String>
 <mx:String> e</mx:String>
 </mx:dataProvider>
 </mx:ComboBox>

 

Then, you can set a labelFunction on the ComboBox itemRenderer like this:

private function myLabelFunction(item:Object):String

    {

        switch(item)

        {

           case "b": return "beginner";

           case "i": return "intermediate";

           default: return "expert";

        }

    }

 


From: [email protected] [mailto:[email protected]] On Behalf Of sahay17
Sent: Monday, September 11, 2006 10:47 PM
To: [email protected]
Subject: [flexcoders] Re: Datagrid with a dropdown column!

 

Hi Joan,
Thanks for the reply. It was really helpful.But the problem now is
that the datagridcolumn rating is picking 'b' or 'i' or 'e' from the
array collection and now I have to map 'b' to 'beginner' in the
combobox. Similary I have to map 'i' to 'intermediate' in combobox
and similary I have to map 'e' to 'expert' in combobox. How to get on
with it?

--- In [EMAIL PROTECTED]ups.com, "Joan Lafferty" <[EMAIL PROTECTED]> wrote:
>
> Anurag,
>
>
>
> Yes, as someone pointed out before, you can use a custom
itemRenderer.
> Yours would look something like the code provided below. Notice
that if
> you want the ComboBox to be editable, you should specify that
> renderIsEditor="true" and specify the editorDataField.
>
>
>
> <mx:DataGrid id="skillDG" width="100%" height="100%"
> sortableColumns="true" dataProvider="{_model}" editable="true">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn headerText="Skill Name"
> dataField="skillName" editable="false"/>
>
> <mx:DataGridColumn headerText="Rating"
> dataField="ratingId" rendererIsEditor
>
<http://flashteam.macromedia.com/flashplatform/imd/zaphod/deliverables
/Z
>
orn/LangRef/mx/controls/dataGridClasses/DataGridColumn.html#rendererIs
Ed
> itor> ="true" editorDataField="selectedItem" >
>
> <mx:itemRenderer>
>
> <mx:Component>
>
> <mx:ComboBox>
>
> <mx:dataProvider>
>
> <mx:String> beginner</mx:String>
>
> <mx:String> intermediate</mx:String>
>
> <mx:String> expert</mx:String>
>
> </mx:dataProvider>
>
> </mx:ComboBox>
>
> </mx:Component>
>
> </mx:itemRenderer>
>
> </mx:DataGridColumn>
>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
>
>
>
> Joan
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of sahay17
> Sent: Monday, September 11, 2006 2:38 AM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] Datagrid with a dropdown column!
>
>
>
> Hi all,
> I am having a datagrid "skillDG" with 2 datagridcolumn
as "skillName"
> and "ratingId" which is picking data from arraycollection.
>
> <mx:DataGrid id="skillDG" width="100%" height="100%"
> sortableColumns="true" dataProvider="{_model}" editable="true">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn headerText="Skill Name"
> dataField="skillName" editable="false"/>
>
> <mx:DataGridColumn headerText="Rating"
> dataField="ratingId" />
>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
>
> But now i want that my datafieldcolumn "ratingId" to be a dropdown
> with skills namely beginner,intermediate and expert. Is it possible?
>
> Thanks and Regards,
> Anurag.
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to