0 Replies Latest reply on Mar 23, 2011 1:09 PM by arvaroo

    Creating a dynamic nested menu with xml data received from a webservice

    arvaroo

      I need to create a dynamic menu based on a xml returned by a webservice.
      the xml comes basically in this format:
      [quote]
      <resposta>

       

          <status>Success</status>
          <mensagem>Whatever</mensagem>

       

          <dados>
              <projeto nome="name" cliente="client name">
                  <atividade nome="name">

       

                      <etapa>
                          <nome>name</nome>
                           <other_attributes>...</other_attributes>
                      </etapa>

       

                      (other etapas)
                   
                   </atividade>

       

                   (other atividades)
              </projeto>

       

              (other projetos)
          </dados>
      </resposta>
      [/quote]

       

      What I need is to create a menu like:

       

      - Projeto.Nome - Projeto.Cliente:
          - Atividade.nome:
              (start button) etapa1
              (start button) etapa2

       

      - Projeto2.Nome - Projeto2.Cliente:
          - Atividade.nome:
              (start button) etapa1
              (start button) etapa2

       

      And so on...

       

      I've tried using an HTTPService and a DataGroup, this code above works fine for  display the projeto's names:

       

      [quote]
      <s:HTTPService id="loginService"
                              url="http://timesheet.infinitech.local/services"
                              method="POST" contentType="application/xml"
                              result="handleLoginResult();"
                              fault="handleFault(event);" >

       

                              <s:request xmlns="">
                                  <requisicao>
                                      <tipo>login</tipo>
                                      <usuario>{campoUsuario.text}</usuario>
                                      <senha>{campoSenha.text}</senha>
                      </requisicao>
                  </s:request>
      </s:HTTPService>

       

       

       

      and the DataGroup:

       

      <s:DataGroup dataProvider="{tarefasService.lastResult.resposta.dados.projeto}" width="100%" y="100" x="20"
                           includeIn="Principal">
                  <s:layout>
                      <s:VerticalLayout />
                  </s:layout>
                  <s:itemRenderer>
                      <fx:Component>
                          <s:ItemRenderer>
                              <s:layout>
                                  <s:HorizontalLayout />
                              </s:layout>
                              <s:Button />
                              <s:Label text="{data.nome}" />
                          </s:ItemRenderer>
                      </fx:Component>
                  </s:itemRenderer>
              </s:DataGroup>
      [/quote]

       

      I have then tried including another datagroup inside the datagroup item renderer, but I just couldn't get it to work anyway, and tried it in a lot of ways... (basically, it would be a datagroup with dataProvider={data.atividade}).

       

      Can anyone tell me how to get this to work?

       

      I've uploaded an example xml, you can use it as the url for the HTTPService:
      http://www.pdinfo.com.br/example.xml

       

      Thanks in advance.