Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7171455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:25:05+00:00 2026-05-28T15:25:05+00:00

I have a mx:Datagrid in witch I’d like to add a combobox as item

  • 0

I have a mx:Datagrid in witch I’d like to add a combobox as item renderer.

 <mx:DataGrid  id="dgEnsActes"
                             horizontalScrollPolicy="on"
                             dataProvider="{arListeDevis}"
                             width="100%" height="100%" >
                    <mx:columns>
                        <mx:DataGridColumn dataField="dvIndex"  headerText="" headerStyleName="dgHeader" fontWeight="normal" width="40"/>
                        <mx:DataGridColumn dataField="dvLibelle" headerText="Libellé" headerStyleName="dgHeader" wordWrap="true" fontWeight="normal" width="180"/>
                        <mx:DataGridColumn dataField="dvTotal" headerText="Total" headerStyleName="dgHeader" width="60" fontWeight="normal"/>
                        <mx:DataGridColumn dataField="dvStatut" headerText="Statut" 
                                           rendererIsEditor="true" editorDataField="result" itemRenderer="fr.inters.ui.itemRenderer.irComboEtatDevis"
                                           wordWrap="true" headerStyleName="dgHeader" fontWeight="normal" width="70"/>
                        <mx:DataGridColumn dataField="dvAcceptDirect" headerText="Création" headerStyleName="dgHeader" width="60" fontWeight="normal"/>

                    </mx:columns>

                </mx:DataGrid>

My custom item renderer is like that:

    <?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">


    <fx:Script>
        <![CDATA[
            public var result:String="";
            [Bindable] var dpValue:Array=[
                {label:"Accepté", data:"Accepté"},
                {label:"Refusé", data: "Refusé"},
                {label:"En attente", data: "En attente"}];


            override public function set data(value:Object):void 
            {
                super.data = value;
                if (value != null) 
                {
                    var currentValue:String = value.size;
                    var len:int = dpValue.length;
                    for (var i:int = 0; i < len; i++) 
                    {
                        if (dpValue[i].data == currentValue) 
                        {
                            editor.selectedIndex = i;
                            break;
                        }
                    }
                }
            } 

            public function onChange():void 
            {
                var index:int = editor.selectedIndex;
                result = dpValue[index].data;
            }


        ]]>
    </fx:Script>
    <mx:ComboBox id="editor" dataProvider="{dpValue}" width="130" change="onChange()"/>

</s:MXDataGridItemRenderer>

But when I try to debug an error appear, the message is selectedIndex is undefined

Is someone to help me?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:25:06+00:00Added an answer on May 28, 2026 at 3:25 pm

    Why don’t you use the combobox without a grid item renderer?

    have a look at this sample at http://blog.flexmp.com/2008/02/18/simple-datagrid-combobox-as-item-editor-example/

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:XML id="xml" source="weather.xml"/>
            <mx:DataGrid id="myDatagrid" dataProvider="{xml.city}"
                    variableRowHeight="true" editable="true" rowHeight="50"
                    width="300" height="300">
                    <mx:columns>
                    <mx:DataGridColumn dataField="Location"/>
                    <mx:DataGridColumn dataField="Climate" editable="true" editorDataField="value">
                            <mx:itemEditor>
                                    <mx:Component>
                                            <mx:ComboBox editable="true">
                                                    <mx:dataProvider>
                                                            <mx:String>Mild</mx:String>
                                                            <mx:String>Hot</mx:String>
                                                            <mx:String>Foggy</mx:String>
                                                            <mx:String>Rainy</mx:String>
                                                            <mx:String>Snow</mx:String>
                                                    </mx:dataProvider>
                                            </mx:ComboBox>
                                    </mx:Component>
                            </mx:itemEditor>
                    </mx:DataGridColumn>
                    <mx:DataGridColumn dataField="CloudCoverPercent" editable="true" editorDataField="value"
                            itemEditor="CloudCover"/>
            </mx:columns>
            </mx:DataGrid>
    </mx:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid (WPF Toolkit) with a custom combobox like edit template of
I have a DataGrid with a ComboBox in a DataTemplate <DataGridTemplateColumn Header=Stock Name Width=290>
I have a datagrid with 2 columns. I need to access the item renderer
I have a datagrid with an XML object as dataprovider. There are 2 columns
I have DataGrid with horizontal scrollbar. How can I get its visible width?
I have a datagrid with master detail implementation as follows: <data:DataGrid x:Name=dgData Width=600 ItemsSource={Binding
I have a DataGrid with a NumericStepper as the item editor for one of
I have a DataGrid with info like this: Associate Amount Time Customer John Doe
I have a datagrid with different types of columns, like I have checkboxes, combo
I have a datagrid with linkbutton inside it. <asp:DataGrid id=listDataGrid Runat=server> <Columns> <asp:TemplateColumn HeaderText=Item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.