This has worked fine for many versions prior. After update to ColdFusion 2016, cfgrid
produces an error when trying to update a cell like active status from 2 to 3 for an item.
User updates the cell and hits enter, then refreshes the grid and sees their change is not stored. The cfdebug
error from AJAX logger is cfgridchanged is undefined
. Any suggestions on how to make this work in ColdFusion 2016?
<cfgrid name="modify_pids"
height=525
autowidth="yes"
width=1040
vspace=10
selectmode="edit"
insert="No"
delete="No"
format="html"
selectonload = "no"
striperows = "yes"
selectcolor="CDE6F3"
preservePageOnSort="Yes"
pagesize=100
sort=true
onChange="cfc:functions_pids.updatePID({cfgridaction},{cfgridrow}, {cfgridchanged}, '#getcurruser.uid#')"
bind="cfc:functions_pids.getPIDS({cfgridpage},{cfgridpagesize}, {cfgridsortcolumn},{cfgridsortdirection}, '#mygridsortcolumn#', searchPID(), searchDESC(), searchSTAT(), searchMOQ(), searchCOST(), searchUNIT(), searchMODBY(), searchMODDATE() )">
<cfgridcolumn name="PID_ID"
header="PID"
width=40
headeralign="center"
headerbold="Yes"
select="No">
<cfgridcolumn name="Description"
header="Description"
width=150
headeralign="center"
headerbold="Yes"
select="Yes">
<cfgridcolumn name="Active_Status"
header="Status<br>Active=1,3<br>Inactive=2"
width=35
headeralign="center"
headerbold="Yes"
select="Yes"
display="yes">
<cfgridcolumn name="MOQ"
header="MOQ"
width=20
headeralign="center"
headerbold="Yes"
select="Yes">
<cfgridcolumn name="COST"
header="Cost"
width=40
headeralign="center"
headerbold="Yes"
select="Yes">
<cfgridcolumn name="UNIT"
header="Unit"
width=40
headeralign="center"
headerbold="Yes"
select="Yes">
<cfgridcolumn name="Modify"
header="Modified By"
width=50
headeralign="center"
headerbold="No"
select="No">
<cfgridcolumn name="Modify_Date"
header="Modified Date"
width=60
headeralign="center"
headerbold="Yes"
select="No"
type="date">
<cfgridcolumn name="PID_USED"
header="Inventory<br>Instances"
width=50
headeralign="center"
headerbold="No"
select="No">
<cfgridcolumn name="Inventory_Sum"
header="Inventory<br>Total"
width=50
headeralign="center"
headerbold="No"
select="No">
</cfgrid>
the section from functions_pids.cfc
<cffunction name="updatePID" access="remote" output="false">
<cfargument name="cfgridaction">
<cfargument name="cfgridrow">
<cfargument name="cfgridchanged">
<cfargument name="getcurruser"> <!--- pass in modified by user id --->
<cfargument name="PID_ID" required="no" type="string" default="" >
<cfset strctKey=StructKeyArray(cfgridchanged) />
<cfset strctVal=StructFindKey(cfgridchanged, strctKey[1]) />
<cfset strctVal=strctVal[1] />
<cfif cfgridaction is "D">
<cfelseif cfgridaction is "U">
<cfquery name="update" datasource="#request.dbname#" username="#request.dbuser#" password="#request.dbpw#">
UPDATE PIDS
SET #strctKey[1]# = '#strctVal.value#',
Modify = '#getcurruser#',
Modify_Date = '#dateformat(CreateODBCDateTime( Now()), "mm/dd/yyyy")#'
WHERE PID_ID = '#cfgridrow.PID_ID#'
</cfquery>
<cfelseif cfgridaction is "I">
</cfif>
<cfreturn />
</cffunction>
Promoted from the comments
Which update did you apply when this broke? I know Adobe just released another update a couple of days ago - Update 5. That update includes some changes for CFGrid as well as AJAX functionality. Bugs fixed in ColdFusion (2016 release) Update 5