3 Replies Latest reply on Oct 30, 2008 11:33 PM by Devendran

    Datagrid with embedded combo box

    mauprice01
      I have a datagrid with an embedded combo box, I am having difficulty in getting the combo box to receive the data from the php script.
      Thje datagrid works perfectly and populates the rows and columns properly, but the combo box is not working properly.

      I have to put a combo box on the stage and populate it and then point the datagrid combo box to the combo box on the stage to get it to work.

      There must be a better way.

      Live demo of this datagrid


      My source files

      here is the link to my live demo



      Can someone point to a solution please.

      Thank you for your help.
        • 1. Re: Datagrid with embedded combo box
          Devendran Level 1
          Just check the below URL for detailed explanation about the Cell Renderer.

          http://www.flash-db.com/Tutorials/cellrenderer/index.php
          • 2. Re: Datagrid with embedded combo box
            mauprice01 Level 1
            I have re read the Cell Render documentation and looked at all the examples I can find of which there are only 3

            all of them receive the data to populate the combo box from hard coded arrays with in the actionscript itself, I could not find a single example that receives the data for the datagrid and the combo box from a remote source like a php script or text file.

            I have been trying for days to get this datagrid combo box to work properly.

            I can get it to work if I put the data array in the CellRenderComboBox.as file as follows.

            this is what the examples show.

            private static var COMBOBOX_DATA_PROVIDER : Array = [{label: "unrated", data: 0},
            {label: "low", data: 1},
            {label: "medium", data: 2},
            {label: "high", data: 3}];

            when I declare it like that it works,

            When I get the data from a data provider as follows it doesn't work.

            private static var COMBOBOX_DATA_PROVIDER = _root.cbdata;

            However I can get it to work by putting a combo box on the main stage with the same name as cbdata then it works.

            Whats with this?

            Why do I have to have a combo box on the stage for the ones in the datagrid to work when pulling data from an external source?

            I can't believe the difficulty i'm having doing this. everything else has been quite easy.
            And there seems to be very few comments or examples anywhere of datagrid with combo box being populated from an external source. There are examples of them being populated from within the actionscript itself but not from an external source. I'm wondering if there is some problem with this.

            Can anyone see where I'm going wrong?

            Or is it something that can't be done in flash?


            Working Example using combo box on stage

            my files zipped
            • 3. Re: Datagrid with embedded combo box
              Devendran Level 1
              Nothing wrong with you Cell Rendering method.

              The Problem is With the Data Loading Time.

              you are calling setting the Data to the Combo Without Checking whether it is loaded or not.

              BCZ, You are calling Two PHP Calls at a time, We are not sure which one will be triggered First.

              So the Solution For your Code would be.

              1. Declare one Array (Sample : cbdata)
              2. Load the Combo Data PHP and Store the Result in ComboData_arr
              3. load the DataGrid Data Provider PHP
              4. Assign the Data to the DataGrid.
              5. Inside the Cell renderer use that dbdata Array
              1 person found this helpful