2 Replies Latest reply on Nov 10, 2010 4:01 AM by jfb00

    Fire a headerRenderer comboBox

    jfb00 Level 3

      Hi All,

      I have a comboBox as headerRendeder in a datagrid. I'm able to fire a parent function from my renderer using this solution:

      var parObj :PARENT MXML FILE NAME=this.parentDocument as [PARENT MXML FILE NAME];



      FROM = http://forums.adobe.com/thread/745053?tstart=30

      Now how can I fire the comboBox from my form? User can select values on the comboBox later but I need to fill the datagrid column with values base from a different selection.

      I try to declare the component at the begining of the form but when I call the comboBox, its null.




        • 1. Re: Fire a headerRenderer comboBox
          rvollmar Level 1



          You can do this by defining a custom DataGrid header class which contains a ComboBox.  In that class, add an event listener for a "doSomething" event from the DataGrid (dg1).  e.g.:


                      private function doUpdateComplete():void{
                          FlexGlobals.topLevelApplication.dg1.addEventListener("doSomething", doSomething);


          Assign this header to a column:


                  <mx:DataGrid id="dg1" dataProvider="{ac1}">
                          <mx:DataGridColumn dataField="fName" headerRenderer="TheHeaderRenderer" />


          The doSomething() method calls the ComboBox's openDropDown() method.  Then, in the main app, add a button to have the DataGrid dispatch the event:


          <s:Button label="show dropdown" click="dg1.dispatchEvent(new Event('doSomething'))" />


          That opens the ComboBox in the DataGridColumn's header.

          • 2. Re: Fire a headerRenderer comboBox
            jfb00 Level 3

            Thanks for you reply and help.

            I use this comboBox component in different datagrids in my form.

            Can this work?

            var dgObj:DataGrid = this.parent as DataGrid;
            dgObj.addEventListener("fireCombo", fireCombo);


            private function fireCombo(e:Event):void{
                         //Change selected index 


            In my comboBox I have this function:

            private function onSelectionChange(e:ListEvent):void
                            var oldReqID:Number = selectedItem.ID;
                            var parObj:myForm= this.parentDocument as myForm;
                            parObj.setNewID(oldReqID);  //This fuction is in my form


            What i need from my form is to set the selectedItem to be a default number like 1 and fire the comboBox to display the info.