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: flexcoders@yahoogroups.com
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 I am 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.





 

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, pleaserefrain 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. Nothing in this communication shall constitute a solicitation or recommendation to buy or sell a particular security.

Reply via email to