2 Replies Latest reply on Jan 24, 2011 2:56 AM by Gurdeep Singh

    Populate comboboxes INSIDE a datagrid with UNIQUE data




      i've searched for several hours, and didn't find an answer for my problem.


      i'm trying to place comboboxes in a datagrid filled with DYNAMIC data. (the number and the content of these comboboxes always change. i don't know in advance how many columns there are, where i need to use comboboxes. so every single combobox gets a unique dataprovider, which comes from an external source, WHEN the program runs.)


      -i found MANY threads discussing this problem, but solving via crappy mxml files, filling the comboboxes inside the sourcecode by hand. i want to point out, that isn't good for me.


      -i found a better solution, in which they used some sort of custom itemrenderer to get the data from the internet. (kind of a country chooser thing) but sadly that wasn't good enough, because the number and name of the countries in the world are static more or less, they don't change. so their renderer class didn't depend on any parameters from the main algorithm.


      but in my program i calculate the data in my own actionscript objects, then fill an arraylist with that. so at the beginning i load the desired data from the net, and when i get the response of the urlrequest, AFTER that i start to populate the datagrid/combobox.


      i can fill any datagrid or combobox without trouble, but to put that combobox inside a datagrid cell seems to be impossible.


      could anyone please help? it drives me crazy. i managed to do this in several languages before, c#, java, even php+html, but in flex it looks way too complicated then it should be.

        • 1. Re: Populate comboboxes INSIDE a datagrid with UNIQUE data
          sedios Level 1

          i'm aware, that this amount of network activity could mean some load on the server. i didn't design the philosophy behind it, i just need to wrote a client which meets the expectations. my program looks something like this:


          (i'm willing to rewrite any part of it, just to make those nasty comboboxes work)



          main.mxml file


          this is the main program, i handle some login related stuff here, and set basic design properties for the datagrids. (for example: maxwidth, maxheight, layout constraints etc.)

          nothing interesting, except the command when i instantiate the actionscript class, which i wrote to fill the datagrid.




          private var myGrid1:MyGridType;


          somefunction {

          myGrid1 = new MyGridType(theDatagridDefinedBefore, "argumentNeededToFillDataGridsWithUniqueData");







          MyGridType.as file


          in the constructor i call a urlrequest with the help of the second argument, then add an eventlistener to it. when the data arrives, the eventlistener fires the filler function: i read the results into an arraycollection, then make it the dataprovider for the the datagrid in the first argument.


          so far so good.


          here comes the trouble with the comboboxes. for every column, i instantiate my combobox class. let's call that class "MyComboBoxType".



          blablabla = new MyComboBoxType(theDatagridDefinedBefore, param1, param2, param3);"



          MyComboBoxType.as file


          i do nearly exactly the same, which i did in the MyGridType class. call for help from the net with param1-2-3. when i receive the data, fill an arraycollection. maybe set that arraycollection to be the dataprovider for a combobox. AAAAAAAND now i want that arraycollection or combobox to be on the datagrid.

          • 2. Re: Populate comboboxes INSIDE a datagrid with UNIQUE data
            Gurdeep Singh

            This appears to be a Flex question. Please try the Flex forums here http://forums.adobe.com/community/flex/flex_general_discussion for better esponse to your query.

            1 person found this helpful