Hello everyone, I'm currently having an issue when using cfgridupdate on a cfgrid, whenever I use it, all the columns are shifted by 1 (but not the headers). My code is almost identical to the one given in the adobe documentation of cfgridupdate (https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfgridupdate.html), so it should be working normally, but it's not. Here is below the code I'm using :
<!--- If the gridEntered form field exists, the form was submitted. Perform gridupdate. ---> <cfif IsDefined("form.gridEntered") is True> <cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples" Keyonly="true" tableName = "COURSELIST"> </cfif> <!--- Query the database to fill up the grid. ---> <cfquery name = "GetCourses" dataSource = "cfdocexamples"> SELECT Course_ID, Dept_ID, CorNumber, CorName, CorLevel, CorDesc FROM CourseList ORDER by Dept_ID ASC, CorNumber ASC </cfquery> <h3>cfgrid Example</h3> <I>Try adding a course to the database, and then deleting it.</i> <cfform> <cfgrid name = "FirstGrid" width = "450" format="html" query = "GetCourses" insert = "Yes" delete = "Yes" font = "Tahoma" rowHeaders = "No" colHeaderBold = "Yes" selectMode = "EDIT" insertButton = "Insert a Row" deleteButton = "Delete selected row" > </cfgrid> <cfinput type="submit" name="gridEntered"> </cfform>...
I've seen that there have been issues with this tag in the past, but I never seen some concrete answer even for anterior versions of Coldfusion. Could any of you enlighten me on this, is this a known and solved issue or is it just me ?
It is not that the columns are shifted by one. The problem is that the column CorDesc has no data. Which throws off the formatting of the grid. You should leave it out of the query. That is, use just:
SELECT Course_ID, Dept_ID, CorNumber, CorName, CorLevel
I have tried to do that, but the issue remains the same, the data are still mixed. Here are some screenshots if it can help, the first one is the original grid, the second one is grid after the “DEPT_ID” value of the first row have been changed for “CHEM”, and the form has been submitted :
What if you actually edit every value in the row, even if the value remains the same. That is, you re-type the respective values, 55, CHEM, 100, Physiology, Basic.
You might also want to look into the effect of setting the attribute
In any case, cfgrid is outdated. You should look for alternatives to ColdFusion User Interfaces such as cfgrid.
I have tried to retype every value, it has the same effect : the values are shifted (cornumber = CHEM, corname = 100, etc...). Setting the Keyonly attribute to false did not change anything.
Thank you for the link but I have already seen this website, I'm looking for an integrated way in Coldfusion. Are you saying that cfgrid is something that really should not be used, because if so I think that we will just find another way to do it.
I am indeed suggesting you should not use cfgrid. And I am a ColdFusion fan.
You don't have to look far to know why. Just look at the problem you're currently facing.
There is also something I wish to share. In the last week I have updated ColdFusion to the latest version and did a Windows update. As a result, my browsers can no longer display the grid in https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfgridupdate.html.