Can anyone spot what is wrong here?
 
my AJAX grid IS working but when I try and sort the columns (by clicking in the 
grid) I get the following error... 

Error Executing Database Query.
:http: Invoking CFC: /admin/coldboxproxy.cfc , function: getAllproducts , 
arguments: {"page":1,"pageSize":10,"gridsortcolumn":"NAME","gridsortdir":"ASC"}

I am sure this is something just not getting passed to my service layer 
correctly.

the following is the code, sorry for the long post and help is welcome. thanks 


----------view---------------- 

<cfgrid name="Allproducts"
         format="html"
         pagesize="15"
         striperows="yes"
         selectmode="edit"
         width="auto" 
         height="auto"
         
         bind="cfc:admin.coldboxproxy.getAllproducts({cfgridpage},
                              {cfgridpagesize},
                              {cfgridsortcolumn},
                              {cfgridsortdirection})"
        onchange="cfc:admin.coldboxproxy.editProducts({cfgridaction},
                                 {cfgridrow},
                                 {cfgridchanged})">
  <cfgridcolumn name="prodId" display="false" select="no" width="50" />
  <cfgridcolumn name="productCode" header="Item Code" width="90"/>
  <cfgridcolumn name="name" header="Product Name" width="233" />
  <cfgridcolumn name="price" header="Price" width="65" type="numeric"/>
  <cfgridcolumn name="salePrice" header="Sale" width="65" type="numeric" />
  <cfgridcolumn name="retailPrice" header="RRP" width="65" type="numeric" />
  <cfgridcolumn name="featured" header="Featured" values = "off, on" width="80" 
/>
  <cfgridcolumn name="active" header="Active" values = "on, off" width="60"  />
  <cfgridcolumn name="weight" display="no" header="(kg)" width="50" 
type="numeric" numberformat="99.99" />
  <cfgridcolumn name="minQuantity" header="Min Qty" width="60" display="no" 
values = "1,2,3,4,5,6,7,8,9,10"/>
  <cfgridcolumn name="tax" header="VAT" width="40" numberformat="99..99" 
display="no" />
  <cfgridcolumn name="catname" header="Category" width="220" select="no"/>
</cfgrid>
</cfform>



----------coldboxproxy.cfc----------------
<cffunction name="getAllproducts" output="false" access="remote" 
returntype="any" hint="Process a remote call and return data/objects back.">
  <cfargument name="page" type="numeric" required="yes">
  <cfargument name="pageSize" type="numeric" required="yes">
  <cfargument name="gridsortcolumn" type="string" required="no" default="">
  <cfargument name="gridsortdir" type="string" required="no" default="">

    <cfset var results = "">    
    <cfset results = 
getBean("storeService").getAJAXProducts(page=#arguments.page#,
                                                                                
                                         pageSize=#arguments.pageSize#,
                                                                                
                                         
gridsortcolumn=#arguments.gridsortcolumn#,
                                                                                
                                         gridsortdir=#arguments.gridsortdir#) />

    <!--- Convert Query for Paging --->
    <cfreturn QueryConvertForGrid(results,page,pageSize)>
</cffunction> 



----------service layer: storeService----------------

<!---Get Product Grid AJAX--->
<cffunction name="getAJAXProducts" access="public" returntype="any" 
output="false">
  <cfargument name="page" type="numeric" required="yes">
  <cfargument name="pageSize" type="numeric" required="yes">
  <cfargument name="gridsortcolumn" type="string" required="no" default="">
  <cfargument name="gridsortdir" type="string" required="no" default="">
 <cfscript>
   var results = '';
   results = variables.productGateway.getAJAXProducts(page=#arguments.page#,
                                                                                
                                         pageSize=#arguments.pageSize#,
                                                                                
                                         
gridsortcolumn=#arguments.gridsortcolumn#,
                                                                                
                                         gridsortdir=#arguments.gridsortdir#);
 </cfscript>
 <cfreturn results>
</cffunction> 


----------gateway/DAO----------------


<cffunction name="gridProducts" access="remote" returntype="struct" 
verifyclient="yes" output="no">
  <cfargument name="page" type="numeric" required="yes">
  <cfargument name="pageSize" type="numeric" required="yes">
  <cfargument name="gridsortcolumn" type="string" required="no" default="">
  <cfargument name="gridsortdir" type="string" required="no" default="">
  <!--- Local variables --->
  <cfset var dataquery="">
  <!--- Get data --->
  <cfquery name="dataquery"  datasource="demostoreDS" >
      SELECT p.prodid, p.name, '£' + CONVERT(varchar(12), p.price , 1) AS 
price, p.productCode, 
      p.salePrice, p.retailPrice, p.featured, p.active, p.weight, 
p.minQuantity, p.tax, p.catid, c.name as catName
      FROM products as p
      INNER JOIN categories c ON c.catid = p.catid
      <cfif ARGUMENTS.gridsortcolumn NEQ ""
         and ARGUMENTS.gridsortdir NEQ "">
         ORDER BY <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#ARGUMENTS.gridsortcolumn#"> <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#ARGUMENTS.gridsortdir#">
      </cfif>
      </cfquery>
  <!--- And return it as a grid structure --->
  <cfreturn QueryConvertForGrid(dataquery,
                     ARGUMENTS.page,
                     ARGUMENTS.pageSize)>
</cffunction>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327948
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to