The List classes can’t handle XML, they take arrays of objects.  When you had resultFormat=”xml” you were passing in something that couldn’t be handled.

 

Matt

 


From: jivankohinoor [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 03, 2005 2:51 PM
To: [email protected]
Subject: [flexcoders] Re: datagrid does not display http data

 


Thanks a lot, it was the right idea.
Actually, your piece of code does not compile, but I wrote the
following that works :

<mx:HTTPService id="catalogContents" contentType="application/xml"
method="GET" protocol="http"           
url="" href="http://localhost:8080/protocore/getCatalogContents">http://localhost:8080/protocore/getCatalogContents"     
result="setGridData(event.result)" resultFormat="object"/>

<mx:Script>
  var gridData:Object ;
  function setGridData(o)
  {
    gridData = o ;
  }
</mx:Script>

<mx:DataGrid id="catalogGrid" height="100%" width="100%"
dataProvider="{gridData.elements.element}">

I am still confused why my first method did not work, as I found the
same code in samples applications, like the "restaurants" one:

<mx:HttpService id="srv" url="">
<mx:DataGrid dataProvider="{srv.result.list.restaurant}"/>

I tried the previous code, and it works fine.
with my XML data, it does not work !!! even with small file.
I'd like to understand...

--- In [email protected], "Robert Brueckmann"
<[EMAIL PROTECTED]> wrote:
> Instead of creating an alert with the result attribute of the
> HTTPService request, make a call to a method that would set the
> dataprovider to the resulting XML.
>

>
> The problem is, when the datagrid is created, the XML from the
> HTTPService isn't ready yet, so you need to reset the dataprovider of
> the datagrid once the XML is actually returned.  So try something like:
>

>
> <mx:HTTPService id="catalogContents" contentType="application/xml"
> method="GET" protocol="http" resultFormat="xml"     
> url="" href="http://localhost:8080/protocore/getCatalogContents">http://localhost:8080/protocore/getCatalogContents"
> fault='alert(event.fault.faultstring,"",mx.controls.Alert.OK)'
> result="setData(event.result);" resultFormat="object">
>

>
> <mx:Script>
>
> public function setDate(result:Object) {
>
> catalogGrid.dataProvider = result.element;
>
> }
>
> </mx:Script>
>
> <mx:DataGrid id="catalogGrid" height="100%" width="100%"
> dataProvider="{catalogContents.result.element}">
> ...
>

>
> Not sure if that code will actually work but that's the general gist of
> it.
>

>
> Robert L. Brueckmann
>
> Web Developer
>
> Merlin Securities, LLC
>
> 595 Madison Avenue
>
> New York, NY 10022
>
> p: 212.822.4821
> f: 212.822.4820
>
> ________________________________
>
> From: jivankohinoor [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 02, 2005 10:18 AM
> To: [email protected]
> Subject: [flexcoders] datagrid does not display http data
>

>
>
> I try to fill a DataGrid from live XML data over http, but the grid
> desperately stays empty.
> The code is :
>
> <mx:HTTPService id="catalogContents" contentType="application/xml"
> method="GET" protocol="http" resultFormat="xml"     
> url="" href="http://localhost:8080/protocore/getCatalogContents">http://localhost:8080/protocore/getCatalogContents"
> fault='alert(event.fault.faultstring,"",mx.controls.Alert.OK)'
> result='alert("Catalog OK","",mx.controls.Alert.OK)'>
>
> <mx:DataGrid id="catalogGrid" height="100%" width="100%"
> dataProvider="{catalogContents.result.element}">
>
>
> Returned XML is like :
> <?xml version="1.0" encoding="utf-8"?>
> <elements>
> <element Key="Key" Name="Name" Dir="Dir" lang="lang" nloc="nloc"
> npar="npar" UNKNOWN1="UNKNOWN1" UNKNOWN2="UNKNOWN2" Status="Status"
> Anom="Anom" label="label0" />
> <element Key="BAT000000" Name="COA034" Dir="A1/PRG" lang="Cobol"
> nloc="944" npar="649" UNKNOWN1="58" UNKNOWN2="" Status="CORRECT"
> Anom="OK" label="label1" />
> <element ...>
> </elements>
>
> I know that the Server part is OK, as Iam able to display raw XML
> code in the following TextArea:
> <mx:TextArea text="{catalogContents.result}"/>
>
> I tried the same, with XML compiled statically, and it works :
>
> <mx:Model id="catalogContentsModel"
> ource="D:\\src\\Flex\\Phoenix-proto\\cataloContents.xml" />
>
> <mx:DataGrid id="catalogGrid"
> dataProvider="{catalogContentsModel.result.element}">
>
> Help would be greatly needed, I tried many different combinations of
> returned XML without success (like returning <mx:Array>/<mx:Object>
> tags, specifying the object attributes as XML attributes or as XML
> elements, nothing work)
>
> Am I *really* an idiot as I seem to be the only one with this problem.
>
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=12934rmae/M=298184.6018725.7038619.3001176/
> D=groups/S=1705007207:HM/EXP=1109863127/A=2593423/R=0/SIG=11el9gslf/*htt
> p:/www.netflix.com/Default?mqso=60190075>
>

> <http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
> s/S=:HM/A=2593423/rand=585444464>
>

>
> ________________________________
>
> Yahoo! Groups Links
>
> *      To visit your group on the web, go to:
>       http://groups.yahoo.com/group/flexcoders/
>        
> *      To unsubscribe from this group, send an email to:
>       [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>        
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .

> --------------------------------------------------------
>
> This message contains information from Merlin Securities, LLC, or
from one of its affiliates, that may be confidential and privileged.
If you are not an intended recipient, please refrain from any
disclosure, copying, distribution or use of this information and note
that such actions are prohibited. If you have received this
transmission in error, please notify the sender immediately by
telephone or by replying to this transmission.

> Merlin Securities, LLC is a registered broker-dealer. Services
offered through Merlin Securities, LLC are not insured by the FDIC or
any other Federal Government Agency, are not deposits of or guaranteed
by Merlin Securities, LLC and may lose value

Reply via email to