2 Replies Latest reply on Oct 18, 2006 3:05 PM by Shane McMurray

    problem with webservice and datagrid

    Shane McMurray Level 1
      i'm trying to populate a datagrid with a result set from a CF webservice and it all works fine except when I add the datagridcolumns. it appears to populate the grid, but all the rows are blank.

      its a basic webservice call that returns a resultset from a query lookup and if i don't add the datagridcolumns it works fine, but as soon as add the datafridcolums it appears to populate the grid, but all the rows are blank.

      here is the MXML that works: uncomment the datagridcolumns and it doesn't display the data.

      <?xml version="1.0"?>
      <!-- Simple example to demonstrate the WebService tag. -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

      <mx:WebService id="ws" wsdl=" http://localhost/mydata.cfc?wsdl"
      <mx:operation name="getMyData">

      <mx:Panel title="WebService Example" height="75%" width="75%"
      paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

      <mx:Label width="100%" color="blue"
      text="enter user id."/>

      <mx:TextInput id="userId" text=""/>
      <mx:Button label="Get Items" click="ws.getMyData.send()"/>

      <mx:DataGrid id="dg" width="100%" dataProvider="{ws.getMyData.lastResult}">
      <!-- <mx:columns>
      <mx:DataGridColumn dataField="col1" headerText="Col 1"/>
      <mx:DataGridColumn dataField="col2" headerText="Col 2"/>
      <mx:DataGridColumn dataField="col3" headerText="Col 3"/>
      <mx:DataGridColumn dataField="col4" headerText="Col 4"/>
      </mx:columns> -->




      <cffunction access="remote" name="getMyData" output="no" returntype="query">

      <cfargument name="userId" type="string" required="yes">

      <cfquery name="thisQuery" datasource="somedsn">
      col1, col2, col3, col4
      userId = '#userId#'

      <cfreturn thisQuery>



      all the examples i've looked at just use the column name to bind to the grid column... what am i missing? thanks.