Skip to main content
Participant
August 13, 2020
Question

Cfgridupdate shifts columns by 1 - CF2018

  • August 13, 2020
  • 1 reply
  • 444 views

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 ?

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    August 15, 2020

    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

     

    amaury.1Author
    Participant
    August 17, 2020

    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 :

    BKBK
    Community Expert
    Community Expert
    August 18, 2020

    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 

     

     

    Keyonly="false"

     

     

    in cfgridupdate.

    In any case, cfgrid is outdated. You should look for alternatives to ColdFusion User Interfaces such as cfgrid.