Inserting with CFGRID in CF 9
I've noticed Coldfusion 9 seems to support inserting records with CFGRID
Heres an example Im working on
<cfgrid format="html" name="grid01" pagesize=20 autoWidth="true" width="925"
stripeRows=true stripeRowColor="silver"
bind="cfc:getStuff.getData({cfgridpage},{cfgridpagesize},
{cfgridsortcolumn},{cfgridsortdirection})"
delete="no" selectmode="edit"
insert="true"
onchange="cfc:modifyStuff.editData({cfgridaction},{cfgridrow},{cfgridchanged})">
There are of course columns included below.
What I'm trying to do is figure out how to make that empty row you get (when you click insert at the bottom of the grid) actually insert that information as a new row.
Here is my corresponding CFC for updating/editing data (which works fine for edits):
<cffunction name="editData" access="remote" output="true" roles="Admin,PAM">
<cfargument name="gridaction">
<cfargument name="gridrow">
<cfargument name="gridchanged">
<cfif isStruct(gridrow) and isStruct(gridchanged)>
<cfif gridaction eq "U">
<cfset colname=structkeylist(gridchanged)>
<cfset value=structfind(gridchanged,#colname#)>
<cfquery name="updateAssets">
update table set <cfoutput>#colname#</cfoutput> =
'<cfoutput>#value#</cfoutput>'
where id = <cfoutput>#gridrow.Id#</cfoutput>
</cfquery>
</cfif>
</cfif>
</cffunction>
Is there another gridaction value that corresponds to inserting? I couldn't find any example online of doing this in CF 9 without using an insert button instead of a new row. Seems like this should be built in.
