• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF9 cfgrid array all mixed up on editing?

Guest
Apr 16, 2010 Apr 16, 2010

Copy link to clipboard

Copied

I have a cfgrid that is editable.  Two colums are visible, one is the primary key and is not visible or selectable.

Upon making an edit to a row, submitting the form and doing a cfdump of the form, something very odd is apparent:

This is when the grid is first populated.

query
CFGRIDROWINDEXIDIDTYPEID_ID
110000WGN11093

I change the value of ID to 0001 and leave everything else the same (ID_ID is the pk). Upon submitting the form and doing a quick cfdump before anything is updated to the db...

IDGRID.ID
array
111093
IDGRID.IDTYPE
array
10000
IDGRID.ID_ID
array
111093
IDGRID.ORIGINAL.ID
array
10001
IDGRID.ORIGINAL.IDTYPE
array
1WGN
IDGRID.ORIGINAL.ID_ID
array
111093
IDGRID.ROWSTATUS.ACTION
array
1U

The values are all messed up.  grid.original.id actually has the updated value.  And it mistakenly puts the orignal value into an updated value for idtype.

This ends up updating the wrong fields in my db!

What the heck?

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2010 Apr 18, 2010

Copy link to clipboard

Copied

I've managed to narrow down the issue.

In the grid, if the column holding the hidden field (the pk) is set to select='no' (which is what's needed), the problem happens.

Setting it to 'yes' or not including it will get rid of the problem and the grid updates fine.

That's an issue though b/c I don't want to user messing w/the pk field.

help..?    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

I have the same problem. Seems like a pretty big bug to me. Except I don't see any change by making the key field selectable; mine are still hosed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

Thanks to stuttsdc I was able to get this working. Here is a bit more information.  Not only must the primary key be selectable (a huge problem that I hope will be in a hot fix soon), but any column to the left of a column being edited must also be selectable. So in other words, if you have 6 columns and want column 5 to be editable, the prior four must also be editable.

I am going to try putting the primary key to the far right, set it as not selectable, to see if this works. Just haven't had time yet.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 05, 2010 Jun 05, 2010

Copy link to clipboard

Copied

Could you pls post some simplified stand-alone code that demonstrates this issue?  Cheers.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2010 Jun 29, 2010

Copy link to clipboard

Copied

LATEST

What I've found is that all display=false select=no fields need to be to the right of any editable columns.  If not, all hell breaks loose when the grid gets submitted.

This is a pretty big bug imo.

@Adam - below is some sample code and some screen shots.  Be sure to click the "insert" button on the grid to add a new record.  I am currently just running the Developer edition (9,0,0,251028) on a Windows 2003 server.

- Tim


<!--- Dump form fields --->
<cfdump var="#form#"><br>

<!--- define form --->
<cfform name="testForm" id="testForm" format="html">

    <!--- define grid --->
    <cfset args = structNew()>
    <cfset args.name="testGrid">
    <cfset args.format="html">
    <cfset args.selectmode="edit">
    <cfset args.insert="yes">
    <cfgrid attributeCollection="#args#">
        <cfgridcolumn name="id"     header="Internal ID" display="false" select="no" >
       
        <cfgridcolumn name="name"     header="Name"     type="string_noCase" >
        <cfgridcolumn name="age"     header="Age"     type="numeric">
    </cfgrid>

    <!--- submit button --->
    <br><cfinput type="submit" name="submitBtn">

</cfform>

shot1.jpg

shot2.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation