5 Replies Latest reply on Nov 20, 2009 6:51 AM by madhooper

    xml data populating the tree but I need to link to the datagrid

    madhooper Level 1

      I have xml populating the tree from a webservice.

       

      My question is how do I get a datagrid to display the data contain in the trees folders? Simialar to how Windows Explorer works.


      Has anyone done something remotely (or even exactly) like this before? If so, can I get some tips on the best way to approach the problem?

       

      Thanks in advance for your assistance.

        • 1. Re: xml data populating the tree but I need to link to the datagrid
          paul.williams Level 4

          You can probably do this with an e4x expression but we'd need to know the structure of the XML to help you with this. Can you post and example?

          • 2. Re: xml data populating the tree but I need to link to the datagrid
            madhooper Level 1

            Thanks for your response.

             

            Here's the xml structure:

             

            (Object)#0
              ordersArray = (Array)#1
                [0] (Object)#2
                  application = "LIVE"
                  comment = "47560342675023"
                  company = "BS Team "
                  confirmedDate = (null)
                  createDate = "2009-10-29 01:26:12"
                  date = "2009-10-29 01:26:12"
                  id = "0b76c81e-c42a-11de-a9bb-000c29ca435a"
                  itemCount = "0"
                  make = ""
                  model = "Escape/Mariner TM1 2001-2006"
                  name = "Amanda B. Reckondwith"
                  order_guid = "0b76c81e-c42a-11de-a9bb-000c29ca435a"
                  po = ""
                  ref = ""
                  status_code = "0"
                  taxCode = ""
                  user = "hf@if"
                [1] (Object)#3
                  application = "LIVE"
                  comment = ""
                  company = "BS Team "
                  confirmedDate = (null)
                  createDate = "2009-11-03 02:32:07"
                  date = "2009-11-03 02:32:07"
                  id = ""
                  itemCount = "0"
                  make = ""
                  model = "Escape/Mariner TM1 2001-2006"
                  name = "Rufus Leaking"
                  order_guid = "14f4e38a-c821-11de-a9bb-000c29ca435a"
                  po = ""
                  ref = ""
                  status_code = "0"
                  taxCode = ""
                  user = "pwa@infu"
                [2] (Object)#4
                  application = "LIVE"
                  comment = ""
                  company = "BS Team "
                  confirmedDate = (null)
                  createDate = "2009-11-03 19:43:00"
                  date = "2009-11-03 19:43:00"
                  id = ""
                  itemCount = "0"
                  make = ""
                  model = "Escape/Mariner TM1 2001-2006"
                  name = "Rufus Leaking"
                  order_guid = "17b6ae4c-c8b1-11de-a9bb-000c29ca435a"
                  po = ""
                  ref = ""
                  status_code = "0"
                  taxCode = ""
                  user = "sas"
                [3] (Object)#5
                  application = "LIVE"
                  comment = "123"
                  company = "Nic's Test Account"
                  confirmedDate = (null)
                  createDate = "2009-11-05 16:49:28"
                  date = "2009-11-05 16:49:28"
                  id = "2eac7566-ca2b-11de-a9bb-000c29ca435a"
                  itemCount = "0"
                  make = ""
                  model = "Tracer MM 1987-1999"
                  name = "DGH2"
                  order_guid = "2eac7566-ca2b-11de-a9bb-000c29ca435a"
                  po = ""
                  ref = "123"
                  status_code = "0"
                  taxCode = ""
                  user = "ca@"

            • 3. Re: xml data populating the tree but I need to link to the datagrid
              Matt Le Fevre Level 4

              My question is how do I get a datagrid to display the data contain in the trees folders? Simialar to how Windows Explorer works.


              Has anyone done something remotely (or even exactly) like this before? If so, can I get some tips on the best way to approach the problem?

               

              Thanks in advance for your assistance.

               

              I've done a file browser in a flex app for a project which works in a similar way to windows explorer.

               

              I've link Flex to a PHP script which searches through its root location, and outputs all the folders it finds in a xml format, which i then return to the flex application (in an XML format). This populates a tilelist. When the user clicks on a folder within the tile list, a request is sent off to another PHP script containing the folder name that was clicked on, which then feeds into the PHP, the PHP then opens the chosen folder and returns all the files (in XML format) located within along with additional information about each file (name, creation date, modified date, owner, screenshot preview, etc..)

               

              This is then returned to the flex application to fill another tile list, which uses a custom item renderer to generate items in the tilelist showing all the file information.

               

              for example,

               

              <?php
              
                  $directory = ".//";
                  $handler = opendir($directory);
                  $count = 0;
              
                  while ($file = readdir($handler)) //read all files in current folder
                  {
                      if ($file != '.' && $file != '..') 
                      {
                          list($file1, $file2) = split('[.]', $file); //check the extension of each file
                          
                          if ($file2 == "") //if no file extension, it must be a folder
                          {
                              $results[] = $file; //add foldername to an array
                              $count++;
                          }
                      }
                  }
              
                  $i = 0;
              
                  while ($i =< $count)
                  {
                        print "<Folder><FolderName>".$result[$i]."</FolderName></Folder>";
                        $i++;
                  }
              
              ?>
              

               

              ta daa, a list of folders.

               

              in my case, i then use a similar script to then output all the files each folder.

               

               

              A mockup screenshot may help to understand what you want as well, as i'm kinda unsure what you really want.

              • 4. Re: xml data populating the tree but I need to link to the datagrid
                paul.williams Level 4

                The data you posted does not look like XML and I cannot see a hierarchical structure. Can you post the raw XML? What is the structure of the data? How are you storing it on the client? How are you binding your tree to this structure? What information should be shown in the data grid?

                • 5. Re: xml data populating the tree but I need to link to the datagrid
                  madhooper Level 1

                  Sorry, that was the array from the debugger. I was able to get it to work. I simply put a change event on the tree and binded the datagrid to the tree's selected item.

                   

                  Thanks for your help!!!