6 Replies Latest reply on Sep 27, 2008 12:30 PM by Newsgroup_User

    xml -> data grid

    ice9_us Level 1
      I am not sure at all why this doesn't work..
      my list and all the data in the debugger shows fine...
      But the grid doesn't get the data..
      I am sure it is something simple..


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      initialize="get_hd_list.send()">

      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.collections.XMLListCollection;

      [Bindable]
      private var hdticketData:XMLListCollection = new XMLListCollection();

      public function handleXML(event:ResultEvent): void
      {
      var TicketData:XMLList = new XMLList();
      TicketData = event.result.Ticket;
      hdticketData.source = TicketData;
      }


      ]]>
      </mx:Script>

      <mx:HTTPService id="get_hd_list" url=" http://genesis.dvrdns.org/flex/cgi-bin/list_hdQ.cgi"
      result="handleXML(event)" resultFormat="e4x" />

      <mx:DataGrid dataProvider="{hdticketData}" width="100%" height="100%" />


      </mx:Application>




      this is what gets posted:
      <?xml version="1.0" ?>
      - <HDTickets>
      - <Ticket>
      <ticketname>sev3:ult10-auth_crit-Auth_Critical_Alert_on_ult10-1717</ticketname>
      <tickettype />
      <tickettime />
      <ticketdata />
      <ticketnote />
      </Ticket>
      - <Ticket>
      <ticketname>sev1:ult10-brute_force-brute_force_ftp_on_ult10_attack_85.114.46.3-1718</tick etname>
      <tickettype />
      <tickettime />
      <ticketdata />
      <ticketnote />
      </Ticket>
      - <Ticket>
      <ticketname>sev1:ult10-kernel_warning-kernel_warning_on_host_ult10-1719</ticketname>
      <tickettype />
      <tickettime />
      <ticketdata />
      <ticketnote />
      </Ticket>
      </HDTickets>
        • 1. Re: xml -&gt; data grid
          Level 7

          "ice9_us" <webforumsuser@macromedia.com> wrote in message
          news:gblb67$g1r$1@forums.macromedia.com...
          >I am not sure at all why this doesn't work..
          > my list and all the data in the debugger shows fine...
          > But the grid doesn't get the data..
          > I am sure it is something simple..
          >
          >
          > <?xml version="1.0" encoding="utf-8"?>
          > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          > layout="absolute"
          > initialize="get_hd_list.send()">
          >
          > <mx:Script>
          > <![CDATA[
          > import mx.rpc.events.ResultEvent;
          > import mx.collections.XMLListCollection;
          >
          > [Bindable]
          > private var hdticketData:XMLListCollection = new XMLListCollection();
          >
          > public function handleXML(event:ResultEvent): void
          > {
          > var TicketData:XMLList = new XMLList();
          > TicketData = event.result.Ticket;
          > hdticketData.source = TicketData;
          > }
          >
          >
          > ]]>
          > </mx:Script>
          >
          > <mx:HTTPService id="get_hd_list"
          > url=" http://genesis.dvrdns.org/flex/cgi-bin/list_hdQ.cgi"
          > result="handleXML(event)" resultFormat="e4x" />
          >
          > <mx:DataGrid dataProvider="{hdticketData}" width="100%" height="100%" />

          Try:

          hdticketData.source=TicketData.children();

          -OR-

          dataProvider = "{hdticketData.children()}"



          • 2. Re: xml -&gt; data grid
            Peter Lorent Level 2
            Or simply use ArrayCollection.
            • 3. Re: xml -&gt; data grid
              ice9_us Level 1
              i get this error:

              Main Thread (Suspended: ReferenceError: Error #1065: Variable sev3:ult10-auth_crit-Auth_Critical_Alert_on_ult10-1717 is not defined.)
              mx.binding::Binding/watcherFired
              mx.binding::Watcher/notifyListeners
              mx.binding::PropertyWatcher/eventHandler
              flash.events::EventDispatcher/dispatchEventFunction [no source]
              flash.events::EventDispatcher/dispatchEvent [no source]
              mx.core::UIComponent/dispatchEvent
              ta/set hdticketData
              ta/handleXML
              ta/__get_hd_list_result
              flash.events::EventDispatcher/dispatchEventFunction [no source]
              flash.events::EventDispatcher/dispatchEvent [no source]
              mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent
              mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler
              mx.rpc::Responder/result
              mx.rpc::AsyncRequest/acknowledge
              DirectHTTPMessageResponder/completeHandler
              flash.events::EventDispatcher/dispatchEventFunction [no source]
              flash.events::EventDispatcher/dispatchEvent [no source]
              flash.net::URLLoader/onComplete [no source]
              • 4. Re: xml -&gt; data grid
                ice9_us Level 1
                amy where to i put that in my code..

                Try:

                hdticketData.source=TicketData.children();

                -OR-

                dataProvider = "{hdticketData.children()}"



                i have no idea what your doing there..
                what function is
                children();

                i went to help window and clicked on it.. and it didn't show me anything..
                • 5. Re: xml -&gt; data grid
                  Level 7

                  "ice9_us" <webforumsuser@macromedia.com> wrote in message
                  news:gblvs9$9ri$1@forums.macromedia.com...
                  >i get this error:
                  >
                  > Main Thread (Suspended: ReferenceError: Error #1065: Variable
                  > sev3:ult10-auth_crit-Auth_Critical_Alert_on_ult10-1717 is not defined.)
                  > mx.binding::Binding/watcherFired
                  > mx.binding::Watcher/notifyListeners
                  > mx.binding::PropertyWatcher/eventHandler
                  > flash.events::EventDispatcher/dispatchEventFunction [no source]
                  > flash.events::EventDispatcher/dispatchEvent [no source]
                  > mx.core::UIComponent/dispatchEvent
                  > ta/set hdticketData
                  > ta/handleXML
                  > ta/__get_hd_list_result
                  > flash.events::EventDispatcher/dispatchEventFunction [no source]
                  > flash.events::EventDispatcher/dispatchEvent [no source]
                  >
                  > mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispa
                  > tchRpcEvent
                  >
                  > mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandl
                  > er
                  > mx.rpc::Responder/result
                  > mx.rpc::AsyncRequest/acknowledge
                  > DirectHTTPMessageResponder/completeHandler
                  > flash.events::EventDispatcher/dispatchEventFunction [no source]
                  > flash.events::EventDispatcher/dispatchEvent [no source]
                  > flash.net::URLLoader/onComplete [no source]
                  >

                  I'm not sure how you're viewing the newsgroup, but the threading over NNTP
                  is such that I can't tell who you're replying to, Do you know exactly which
                  line of code is throwing it? It doesn't look like you captured this message
                  from debug mode.


                  • 6. Re: xml -&gt; data grid
                    Level 7

                    "ice9_us" <webforumsuser@macromedia.com> wrote in message
                    news:gbm0e0$aes$1@forums.macromedia.com...
                    > amy where to i put that in my code..
                    >
                    > Try:
                    >
                    > hdticketData.source=TicketData.children();
                    >
                    > -OR-
                    >
                    > dataProvider = "{hdticketData.children()}"
                    >
                    >
                    >
                    > i have no idea what your doing there..
                    > what function is
                    > children();
                    >
                    > i went to help window and clicked on it.. and it didn't show me anything..

                    You were trying to set your dataprovider to the _single_ root node. So you
                    didn't see anything because
                    (a) you didn't have multiple rows
                    (b) your root node doesn't have any of the properties you told the DataGrid
                    to expect.

                    As to where to put it, look over your own code and see where there are two
                    places that look similar to what I posted, but without the children(). Pick
                    one of those, and add children() to it.

                    http://dispatchevent.org/roger/as3-e4x-rundown/