Skip to main content
Gene_Godsey
Inspiring
December 22, 2010
Question

Populating the data grid

  • December 22, 2010
  • 2 replies
  • 682 views

OK I think that is resolved but I cannot pull the Data.

The Grid does not populate with data......Just keeps trying to pull it.

---------------------------------------------------------------------- ------------

THE CFC FUNCTION:

<cffunction name="comments" access="remote" returntype="struct">
  <cfargument name="page" required="true">
  <cfargument name="pageSize" required="true">
  <cfargument name="gridsortcolumn" required="true">
  <cfargument name="gridsortdirection" required="true">
 
   <cfquery name="selectAll" datasource="#dsn#" dbtype="#i#">
    SELECT autoid, CONVERT(VARCHAR(10), sDate, 101) as sDATE, DAGRSN, branch,
      DODAAC, clin, hours
    FROM reporting.DAGRSCRAPS
   </cfquery>
 
  <cfreturn queryconvertforgrid(selectAll,page,pagesize)/>
</cffunction>

---------------------------------------------------------------------- ------------

---------------------------------------------------------------------- ------------

THE DATA GRID ITSELF:

<cfform name="myform" id="myformid">
<cfgrid
name = "myGrid"
format="html"
bindOnLoad="yes"
bind="cfc:pdgps.admin.backoffice.components.Data.comments({cfgridpage },{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
pageSize="10"
preservePageOnSort="true"
selectMode="single"
selectOnLoad="no"
font="Verdana"
fontsize="11"
label="True"
stripeRows="true"
stripeRowColor="##D9CCFF"
selectColor="##994FE6">
  <cfgridcolumn name="autoid" display="no" >
  <cfgridcolumn name="branch" header="SERVICE" type="string_noCase" >
  <cfgridcolumn name="DODAAC" header="DODAAC" type="string_noCase" >
  <cfgridcolumn name="DAGRSN" italic="yes" display="yes" header="DAGRSN">
  <cfgridcolumn name="sDATE" display="yes" header="Date" mask="EEE DD-MMM-YY H:NN A">
  <cfgridcolumn name="clin" width="35" display="yes" >
</cfgrid>
</cfform>

---------------------------------------------------------------------- ------------

    This topic has been closed for replies.

    2 replies

    Inspiring
    December 23, 2010

    The first thing I noticed is that you didn't scope your variables in the cfreturn tag of your function.

    Gene_Godsey
    Inspiring
    December 23, 2010

    Interesting,

    Could you please elaborate a little more so I understand.

    Thanks

    ilssac
    Inspiring
    December 23, 2010

    <cfargument name="gridsortdirection" required="true">

    <cfset var selectAll = "">

    <!--- this 'var' scopes the selectAll variable to be local to this function --->
     
    <cfquery name="selectAll" datasource="#dsn#" dbtype="#i#">

    Also, where are the 'dsn' and 'i' variables defined.  They do not appear to be part of this function.  Using a CFC function remotely has a great effect on what variables scopes may or may not be accessed.

    ilssac
    Inspiring
    December 23, 2010

    Have you used a tool like the Firefox plugin "Firebug" to snoop on the http requests being made with the JavaScript?

    An invaliable tool for debugging AJAX issues.

    Gene_Godsey
    Inspiring
    December 23, 2010

    I have it but never really used it for anything serious.