Sung
Sung

Reputation: 480

CF11 vs. CF2018: CFGRID Binding Error, Element not found

I've been fiddling with this for a while and stumble upon an answer, so I thought I'd post it in hopes that it may save someone else some time.

On CF11, my binding parameter looks like this:

<cfset args.bind = 'cfc:data.RecordSelect({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},"#DataSelect.tableName#","#DataSelect.dsn#",{gridForm:searchColumn},gridForm:searchBox},"#DataSelect.PKName#","#variables.gridColumnsForGrid#")'>

With CF11, this ran just fine, and it works by and large on CF2018, too. The grid sorts, updates, add new records, and delete records. But I also have a dropdown for a filter, and when I try to filter, I get this error:

Element not found: "gridColumn|gridHeading|gridDataType|gridMask|tableName|PKName|searchable|dsn" [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

The element is the list of columns I'm passing to the CFC.

Upvotes: 0

Views: 432

Answers (1)

Sung
Sung

Reputation: 480

Here's the solution:

<cfset args.bind = 'cfc:data.RecordSelect({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{gridForm:tableName},{gridForm:dsn},{gridForm:searchColumn},{gridForm:searchBox},{gridForm:PKName},{gridForm:gridColumnsForGrid})'>

<cfinput type="hidden" name="tableName" id="tableName" value="#DataSelect.tableName#" />
<cfinput type="hidden" name="dsn" id="dsn" value="#DataSelect.dsn#" />
<cfinput type="hidden" name="PKName" id="PKName" value="#DataSelect.PKName#" />
<cfinput type="hidden" name="gridColumnsForGrid" id="gridColumnsForGrid" value="#variables.gridColumnsForGrid#" />

So what this means, from my experience, is that you can no longer pass non-bracketed elements via binding. Maybe this was how I was always supposed to do it, as either way works in CF11.

Of course I know we're not supposed to be using CFGRID anymore since it'll lead to disappointment and ruin...but this is old code and I can't take the time to convert this over to DataTables just yet. :)

Upvotes: 1

Related Questions