William
William

Reputation: 41

CFGRID bind in HTML format does not work in Coldfusion 11

OK, so I've spent the last couple of days researching this issue on various websites including this one and I'm still no closer to having an answer. I have seen claims that this was a bug and was fixed on Adobe's end in one of the CF11 patches and I have even seen one answer that claimed that Adobe was emailing the fix directly to individuals - though no information on how to go about getting Adobe to do that was provided on that webpage.

We just updated our intranet to Coldfusion 11 and pages that have a cfgrid using the HTML format and bind data from a cfc no longer show the cfgrid on the page. Other pages that use the Flash format with cfgrid (which apparently can't use the bind attribute with Flash) do work. These HTML cfgrid pages were working properly in Coldfusion 9 before we migrated to 11.

I have simplified the code as much as I can to eliminate other error possibilities - i.e. I've stripped out formatting and am pulling only a couple columns from the database. Here is the code I am currently working on in my dev sandbox:

<cfgrid format="html"
        name="userGrid"
        bind="cfc:editorFunc.getGridData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
        pagesize="20">
            <cfgridcolumn name="REGION" header="Region">
            <cfgridcolumn name="managmentArea" header="Management Area">
</cfgrid>

Here is the code in the cfc (the query does produce results when dumped to the page):

    <cffunction name="getGridData" access="remote">
    <cfargument name="page">
    <cfargument name="pageSize">
    <cfargument name="gridsortcolumn">
    <cfargument name="gridsortdir">

    <cfquery name="records" datasource="webData">
    SELECT REGION, managmentArea
    FROM areaDesc
    ORDER BY Region ASC
    </cfquery>

     <cfset result = queryConvertForGrid(duplicate(records), arguments.page, arguments.pagesize)>
     <cfreturn result>
</cffunction>

Has anyone had any luck getting a cfgrid like this to work in CF11? I could try a JQuery solution like JGrid, however I would prefer to figure out the existing issue with this code if possible.

Any help is much appreciated.

Upvotes: 4

Views: 1320

Answers (1)

Tom
Tom

Reputation: 1

Add this..

<cfif not len(trim(arguments.gridsortcolumn))>        
    <cfset arguments.gridsortcolumn = "REGION">
    <cfset arguments.gridsortdir = "desc">   
</cfif>

query....

ORDER BY #arguments.gridsortcolumn# #arguments.gridsortdir#

Upvotes: -1

Related Questions