5 Replies Latest reply on Nov 8, 2010 10:10 AM by jfb00

    Datagrid with comboBox headerRenderer question

    jfb00 Level 3

      Hi All,

      I have a comboBox as header renderer in my datagrid.

       

       

      How can I fire a function that it is in my main form (where the datagrid is) when I change the selected item in the comboBox?

      Thanks

       

      Johnny

        • 1. Re: Datagrid with comboBox headerRenderer question
          jfb00 Level 3

          Why my HTML Code didn't show.

          <?xml version="1.0" encoding="utf-8"?>
          <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
                       labelField="label" dataProvider="{acCombo}" rowCount="20"
                       change="onSelectionChange(event)" creationComplete="init()">
              <mx:Script>
                  <![CDATA[
                      import mx.collections.ArrayCollection;
                      import mx.controls.dataGridClasses.DataGridColumn
                      import mx.rpc.events.ResultEvent;
                     
                      [Bindable]private var acCombo:ArrayCollection = new ArrayCollection ([{id:1, label:"Private"},{id:2, label:"Public"}]);

           

                      private var _ownerData:Object;
                     
                      public function init():void
                      {
                          //init code
                      }
                     
                      override public function set data(value:Object):void
                      {
                          if (value is DataGridColumn ){
                             
                          }else
                          {
                              super.data = value
                          }
                      }
                      override public function get data():Object
                      {
                          return _ownerData;
                      }
                     
                      override public function setFocus():void
                      {
                          super.setFocus();
                         
                          open();
                      }
                     
                      private function onSelectionChange(e:ListEvent):void
                      {

           

                      }
                     
                  ]]>
              </mx:Script>
          </mx:ComboBox>

          • 2. Re: Datagrid with comboBox headerRenderer question
            Arun Ganesh Level 3

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

            parObj.somemethod()

            • 3. Re: Datagrid with comboBox headerRenderer question
              jfb00 Level 3

              Thanks for you reply and help.

              I'm going to use this component from different forms.

              Can I do this generic to work for any form that I call this comp?

               

               

              Johnny

              • 4. Re: Datagrid with comboBox headerRenderer question
                Arun Ganesh Level 3

                u need to know the parent class name.


                • 5. Re: Datagrid with comboBox headerRenderer question
                  jfb00 Level 3

                  Now I have the combo working on my datagrid. But base on something outside the datagrid I want to fire the comboBox.

                  How can i refer to the combo that it is inside the datagrid in my form? i need to fire a comboBox public function.

                  Thanks

                   

                  Johnny