DataGris won't populate from WebService call

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139