This week I was working on a cfgrid example for a reader. He needed some help understanding the FORM data on the server side when you’ve done multiple edits to a grid (and if folks want me to pass along what I told him, just say). It’s a bit complex so I wrote up a quick demo and explained how the form data related to what was done on the client side.
During this work I discovered an unfortunate bug with cfgrid and editable grids. If your grid supports deletes along with edits (by using delete=”true” in the cfgrid tag), you can run into an issue where one of your edits will not be passed to the server. What I noticed was that if I edited rows A and B, and then deleted some row C, my form data included the edits for A and the delete for C, but completely lost the edit for B.
I was able to reproduce this in two browsers, and Adam Tuttle was able to reproduce it as well. I’ve file a bug report for it and if you want to quickly test this yourself, just try the code below.
Unfortunately there isn’t really a workaround for this. For now I simply do not recommend using an editable grid that supports delete as well.
<cfquery name="art" datasource="cfartgallery" maxrows="10">
<cfgrid name =”test_data” format=”html” font=”Tahoma” fontsize=”12” query = “art” selectmode=”edit” striperows=”yes” delete=”true” > <cfgridcolumn name=”artid” display=”false” />
<cfgridcolumn name=”artname” display=”true” header=”Art” select=”no” /> <cfgridcolumn name=”price” display=”true” header=”price” select=”yes” /> <cfgridcolumn name=”issold” display=”true” header=”Sold” select=”no” /> <cfgridcolumn name=”largeimage” display=”true” header=”largeimage” select=”yes” />
<cfinput name=”submit” type=”Submit” value=”Submit”>
<cfdump var=”#form#”> </code>