Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
BCPower001 #1
DataGris won't populate from WebService call
I can't get my datagrid to populate from my web service. My web service is a
ColdFusion CFC. I get no errors but a blank datagrid. What am I doing wrong?
:confused;
-- CFC Code ------------------------------------------------------------>
<cfcomponent displayname="MCSD_Employees" output="no" hint="CFC to get
employees">
<cffunction name="getEmployees" access="remote" returntype="query"
output="false" hint="Returns all employees">
<cfquery name="Employees" datasource="MCSD">
SELECT *
FROM Employees_New
</cfquery>
<cfreturn Employees>
</cffunction>
</cfcomponent>
-- MXML Code ------------------------------------------------------------>
<?xml version="1.0" encoding ="utf-8"?>
<mx:Application width ="100%" height="100%"
xmlns:mx="http://www.macromedia.com/2003/mxml" themeColor="haloSilver"
pageTitle="Martin County School District">
<mx:WebService wsdl="http://192.168.0.16/MCSD/Flex/getEmployees.cfc?WSDL"
id="webservice1" showBusyCursor="true" />
<mx:HBox height="100%" width="100%">
<mx:VBox height="100%" width="250">
<mx:Panel headerHeight="0" width="100%" height="100%">
<mx:List id="Employees" width="100%" height="100%" borderThickness="0" />
<mx:ControlBar height="0" visible="false" />
</mx:Panel>
</mx:VBox>
<mx:VBox height="100%" width="100%">
<mx:Panel headerHeight="0" width="100%" height="50%" marginTop="15"
marginBottom="15" marginLeft="15" marginRight="15">
<mx:DataGrid width="100%" height="100%" borderThickness="1"
dataProvider="{webservice1.getEmployees.result}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="GHRSSN" headerText="Social"
width="100" />
<mx:DataGridColumn columnName="GHRLAST" headerText="Last" width="175" />
<mx:DataGridColumn columnName="GHRMID" headerText="Middle"
width="75" />
<mx:DataGridColumn columnName="GHRFRST" headerText="First"
width="175" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:ControlBar height="0" visible="false" />
</mx:Panel>
<mx:TextArea width="100%" height="50%">
</mx:TextArea>
</mx:VBox>
</mx:HBox>
</mx:Application>
BCPower001 Guest
-
How to populate tree with result of webservice return?
I have one webservice I called to return list of division Id and name, and I need to pupolate it to a tree which tah labe is divsion name and data... -
Can a webservice call another webservice?
Hi all, I want one WebService I have, say on a server in Los Angeles, to call methods I have in a 2nd WebService on another server, say in New... -
call webservice
hi i have a webservice which resides on a server on the same LAN that am working at. I have the URL and theWSDL of the webservice. However, i... -
Webservice API Call
I get the following error below upon attempts to access a webservice that attempts to call advapi32.dll I believe this to be a security issue yet... -
Call COM from .NET WebService Help
We are trying to access a COM object from our .NET WebService, but we get System.RunTime.Interopservices.COMException 0x80010105 everytime. We also... -
ntsiii #2
Re: DataGris won't populate from WebService call
I don't see where you are actually calling the webservice. Try this in the
Application tag:
initialize="webservice1.send()"
Also, there us usually an operation associated with a webservice, like
"getData" or something. If there is then the call would be:
webservice1.getData.send()
Instead of binding, which is hard to debug, define a result handler for the
webservice, and inspect the result from there.
Here are a couple links:
[url]http://www.cflex.net/showfiledetails.cfm?ObjectID=18[/url]
[url]http://www.cflex.net/showfiledetails.cfm?ObjectID=223[/url]
Tracy
ntsiii Guest
-
BCPower001 #3
Re: DataGris won't populate from WebService call
sweet. Idid have to call it like you said.
One other question:
How can I extract data from just one column of the returned query? For
instance, if I wanted to bind just the social to a text element:
<mx:Text text="{dataGrid.selectedItem.COLUMN}" />
BCPower001 Guest
-
ntsiii #4
Re: DataGris won't populate from WebService call
Exactly as you guessed. dataGrid.selectedItem return a reference to the
dataProvider row object.
So you can get at any property of that item object with dot notation:
dataGrid.selectedItem.myPropertyName.
For normal objects, myPropertyName is the same string you would use in a
DataGridColumn columnName attribute.
Furthermore, if the object is complex, maybe with a property that is itself an
object, you use a labelFunction, which runs once for each row in the
dataProvider, and gives you access to the item object. So you would access
that value bye doing:
item.myObjectTypeProperty.myOtherProperty.
If the item object is an xml node:
item.childNodes[0].attributes.myAttribute.
Tracy
ntsiii Guest



Reply With Quote

