Coldfusion CFGRID started showing as empty

349 views Asked by At

I have a CMS that has been working without any issue until yesterday when the team reported that the pages are coming up empty, I tested it and it was fine for a while and then I suddently started having the same problem. Tried different browsers, etc. but no difference. Here is the code

<cfform>
    <cfgrid name="pageList" format="html" selectcolor="##669999" query="rsPages" striperows="yes" href="pageEdit.cfm">
    <cfgridcolumn name="pageID" display="no">
    <cfgridcolumn name="pageCountryID" header="Country" width="75">
    <cfgridcolumn name="pageLanguageID" header="Language" width="85">
    <cfgridcolumn name="pageName" header="Page Name" width="125">
    <cfgridcolumn name="pageTitle" header="HTML Title" width="590">
    </cfgrid>
</cfform>

rsPages is defined previously.

If I display the data in a table it's fine, so this is an issue specifically with the CFGRID function. All supporting assets are present, i.e. JS and CSS files.

2

There are 2 answers

2
Anit Kumar On BEST ANSWER

Assuming that, you are using the latest version of ColdFusion(CF 11), I tried with querysetcell and your cfgrid code. The below code works in all browsers.

<cfset rsPages = querynew("pageID, pageCountryID, pageLanguageID, pageName, pageTitle")>
<cfset queryaddrow(rsPages, 3)>

<cfset querysetcell(rsPages,"pageCountryID","Country1",1)>
<cfset querysetcell(rsPages,"pageLanguageID","Language1",1)>
<cfset querysetcell(rsPages,"pageName","Page1",1)>
<cfset querysetcell(rsPages,"pageTitle","Title1",1)>

<cfset querysetcell(rsPages,"pageCountryID","Country2",2)>
<cfset querysetcell(rsPages,"pageLanguageID","Language2",2)>
<cfset querysetcell(rsPages,"pageName","Page2",2)>
<cfset querysetcell(rsPages,"pageTitle","Title2",2)>

<cfset querysetcell(rsPages,"pageCountryID","Country3",3)>
<cfset querysetcell(rsPages,"pageLanguageID","Language3",3)>
<cfset querysetcell(rsPages,"pageName","Page3",3)>
<cfset querysetcell(rsPages,"pageTitle","Title3",3)>

<cfform>
    <cfgrid name="pageList" format="html" selectcolor="##669999" query="rsPages" striperows="yes" href="pageEdit.cfm">
    <cfgridcolumn name="pageID" display="no"> 
    <cfgridcolumn name="pageCountryID" header="Country" width="75">
    <cfgridcolumn name="pageLanguageID" header="Language" width="85">
    <cfgridcolumn name="pageName" header="Page Name" width="125">
    <cfgridcolumn name="pageTitle" header="HTML Title" width="590">
    </cfgrid>
</cfform>

If the above code fails for you, then, most probably, there could be a JS or CSS error. Try enabling browser debugger to find the root cause.

1
Waloob73 On

Solved by converting the cfgrid to cftable, didn't have time to find the reason the cfgrid wasn't working.