3 Replies Latest reply on Aug 11, 2006 3:32 PM by fastcougar1

    DataGrid will not display results ... help!

    fastcougar1
      Please see the code below:

      I'm trying to display an XML file's content in a DataGrid and can't get it to show the results. Any help is greatly appreciated!

      states.cfc code
      quote:

      <cfcomponent>
      <cffunction name="getStates" returntype="string" access="remote" output="no">
      <cfquery name="qGetStates" datasource="SQLServer">
      SELECT stateName
      ,stateCode
      FROM REF_STATES
      WHERE countryCode = <cfqueryparam cfsqltype="cf_sql_char" value="US">
      </cfquery>
      <!--- Create an XML document object containing the data --->
      <cfxml variable="myXML">
      <country>
      <cfoutput query="qGetStates">
      <state>
      <name>#stateName#</name>
      <code>#stateCode#</code>
      </state>
      </cfoutput>
      </country>
      </cfxml>
      <cfreturn toString(myXML)>
      </cffunction>
      </cfcomponent>


      states.mxml file:
      quote:

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

      <mx:WebService id="statesRequest"
      wsdl=" http://localhost/dev/ws/states.cfc?wsdl"
      useProxy="false">

      <mx:operation name="getStates"></mx:operation>

      </mx:WebService>

      <mx:Panel x="10" y="10" width="475" height="400" layout="absolute" title="US States">

      <mx:DataGrid id="dgStates"
      dataProvider="{statesRequest.getStates.lastResult.country.state}" right="10" bottom="10" left="10" top="10" alpha="1.0" cornerRadius="3">
      <mx:columns>
      <mx:DataGridColumn headerText="State Name" dataField="name" width="250"/>
      <mx:DataGridColumn headerText="State Code" dataField="code" width="50" />
      </mx:columns>
      </mx:DataGrid>

      </mx:Panel>


      </mx:Application>