macromedia.coldfusion.getting_started
[Top] [All Lists]

cfgridsortcolumn

Subject: cfgridsortcolumn
From: "kodemonki" <webforumsuser@xxxxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 15:14:46 +0000 (UTC)
Newsgroups: macromedia.coldfusion.getting_started

I'm really new to CFCs and CF8 in general, and I am trying to create a grid 
that reads from a query result set called from another file (both a CFC and a 
.cfm file).  When I use the CFC in IE I get an error saying an exception was 
thrown and not caught, and no employees show up, but the query definitely 
returned the right info, because it shows up fine if I look at the cfdebug 
window.  When I use the CFC in Firefox with Firebug I get no JS errors, but 
also no employees show up.  If I look at the logs, it looks like 
cfgridsortcolumn is undefined in the CFC.  It's default value is NULL, so how 
can it possible be undefined?  Is there something else going on here?  When I 
use the URL it works fine.  When I move these files to a different folder in a 
different branch, both URL and CFC work fine.  

 Any ideas?  Thanks!


 Here is the grid:
 <cfform name="test">
 <cfgrid autowidth="true" name="team" format="html"  width="600" 
 bind="cfc:employeeService.getData({cfgridpage},{cfgridpagesize}, 
{cfgridsortcolumn},{cfgridsortdirection})"
 
<!---bind="url:getEntries.cfm?page={cfgridpage}&pagesize={cfgridpagesize}&sort={
cfgridsortcolumn}&dir={cfgridsortdirection}"--->
 >
    <cfgridcolumn name="employee_id" display="false">
    <cfgridcolumn name="supervisor" display="false">

    <cfgridcolumn name="firstname" header="First Name">
    <cfgridcolumn name="lastname" header="Last Name">
 </cfgrid>
 </cfform>

 Here is the CFC:
 <cfcomponent displayname="employeeService.cfc" output="false">
 <cffunction name="getData" access="remote" output="false">
        <cfargument name="page">
        <cfargument name="pageSize">
        <cfargument name="gridsortcolumn" default="">
        <cfargument name="gridsortdirection" default="">
                <cfquery name="team" datasource="dsn">
                        SELECT  em.firstname, em.employee_id, em.lastname       
                                        
       
 FROM   employees_master em, employee_status_history esm, users u
                        WHERE   em.employee_id = esm.employee_id
                        AND     em.supervisor_employee_id = u.employee_id(+)
                        AND     esm.effective_end_date IS NULL
                        <cfif gridsortcolumn neq "" or gridsortdirection neq "">
                                ORDER BY        #gridsortcolumn# 
#gridsortdirection#
                        <cfelse>
                                ORDER BY  em.lastname
                        </cfif>
                </cfquery>
        <cfreturn QueryConvertForGrid(team, page, pageSize)>
 </cffunction>
 </cfcomponent>

 and here is getEntries.cfm:
 <cfset verifyClient()>

 <cfquery name="team" datasource="dsn">
                        SELECT  em.firstname, em.employee_id, em.lastname
                        FROM    employees_master em, employee_status_history 
esm, users u
                        WHERE   em.employee_id = esm.employee_id
                        AND             em.supervisor_employee_id = 
u.employee_id(+)
                        AND             esm.effective_end_date IS NULL
                        <cfif len(url.sort) and len(url.dir)>
                                order by #url.sort# #url.dir#
                        <cfelse>
                                ORDER BY  em.lastname
                        </cfif>
                </cfquery>
                
 <cfset data = queryConvertForGrid(team, url.page, url.pagesize)>
 <cfset encoded = serializeJSON(data)>
 <cfcontent type="text/json" reset="true"><cfoutput>#encoded#</cfoutput>


<Prev in Thread] Current Thread [Next in Thread>