5 Replies Latest reply on Nov 25, 2009 3:53 AM by Maggs80

    data provider selection




      I'm attempting to create a data provider selection drop down box. The box should allow selection of one of many external XML documents, which when selected, fills in the datagrid below.


      So far I've got the XML documents set up, and have been able to link them with the main project

      I've got the datagrid working nicely with both sizes and behaviours, and displaying data properly

      I've got a drop down working (heheh)


      It's the part where the drop down displays the list of XML docs and allows me to select them as the datagrid data provider that has me stumped.


      I wonder if anyone would be kind enough to point me in the direction of a tutorial, or example code that would allow me to do this. I've had a browse, but can't think of any other terms to use besides the obvious (XML, data provider, data provider selector, data provider selection etc).


      I'm also wondering if what I'm attempting is maybe more complicated than I think, which may be why I haven't stumbled upon anything specific yet.


      All the best,



      P.S. I am new also, which I think may be obvious by the question    Flex looks too useful to pass up learning, so it's time to take the plunge I think.

        • 1. Re: data provider selection
          ShankarFlex3 Level 2



          what exactly is the problem, are you not able to assign to dataProvider?

          • 2. Re: data provider selection
            Prabh Singh Level 1

            if ur XML structure looks like this - <locations><Location><LocationName>..</LocationName><LocationCode>..</LocationCode>...</L ocation>..<Location>...</Location>... </locations>


            And ur DG displays the various columns of the Location XML


            The your dg.dataProvider will be locations.Location


            and the dataField for the different columns will be the individual nodes like LocationName, LocationCode etc.


            Hope this sorts it.

            • 3. Re: data provider selection
              Maggs80 Level 1

              Morning. Sorry. It seems I said a lot but didn't explain very well. My fault


              Thank you both for your replies. I think I should have explained from the point of view of the app actually running.


              So imagine you run the app in your browser, and you see one datagrid, and one drop down box. Inside the drop down is a choice of XML files. Selecting XML file 1, will display the XML1's info in the datagrid. Selecting XML2 will display XML2's info in the datagrid and so on.


              It's creating that drop down that allows me to select XML files for the datagrid to use while the app is running that is my stumbling block.


              I'm familiar with the XML structure and how to display the info correctly inside the datagrid if the XML file is static.


              I am however unsure how to go about being able to select an alternative XML file for the grid to use while the app is running - this is what I'd like to find out how to learn.


              All the best,


              • 4. Re: data provider selection
                Subeesh Arakkan Level 4



                Use Httpservice to load xml files at runtime and set the dataprovider in the result handler of the HttpService. Once an xml is loaded, save it an array or Dictionary so that the second time the same item is selected, you can load it from the array.

                • 5. Re: data provider selection
                  Maggs80 Level 1

                  That did it, thank you!