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

CFGRID shifting column values

New Here ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

Hi,

I have a CFGRID that has 5 columns in which its values are obtained from the database. There is a single submit button that would submit to a processor page that updates any records with changed cells. The problem that I'm having is that the processor page would shift the values of the columns one over. For example, the value of column 4 would display as column 3 on the processor page. Below is the code:

cfgrid page:
<cfform method="post" name="adcost" action="index.cfm?fuseaction=process_advertising_cost_grid">
<cfgrid name="advertizingCosts"
format="HTML"
query="advertizingcosts"
selectMode="edit"
colHeaders="true"
colHeaderBold="yes"
width="600"
maxRows="25"
stripeRows="yes"
stripeRowColor="efefef"
>

<cfgridcolumn name="AdvertizingCostsID" header="ID" width="20" select="no">
<cfgridcolumn name="AdvertizingCostsDate" header="Advertizing Costs Date" mask="MMMM D, YYYY" width="160">
<cfgridcolumn name="Amount" header="Amount" width="60">
<cfgridcolumn name="Details" header="Details">
<cfgridcolumn
name="StoreFrontName"
header="StoreFront"
width="150"
values="#ValueList(storefronts.StoreFrontCode)#"
valuesDisplay="#ValueList(storefronts.StoreFrontName)#"
>
</cfgrid>

<input type="submit" value="submit" class="button" />
</cfform>

processor page:
<cfif IsDefined("form.advertizingCosts.RowStatus.Action")>
<cfloop index="counter" from="1" to="#ArrayLen(form.advertizingCosts.RowStatus.Action)#">
<cfoutput>
<p>
counter is #counter#<br />
The row action for #counter# is #form.advertizingCosts.RowStatus.Action[counter]#<br />
AdvertizingCostsID is #form.advertizingCosts.AdvertizingCostsID[counter]#<br />
AdvertizingCostsDate is #form.advertizingCosts.AdvertizingCostsDate[counter]#<br />
Amount is #form.advertizingCosts.Amount[counter]#<br />
Details is #form.advertizingCosts.Details[counter]#<br />
StoreFrontName is #form.advertizingCosts.StoreFrontName[counter]#
</p>

<cfif #form.advertizingCosts.RowStatus.Action[counter]# eq "U">

<pre>
Original AdvertizingCostsDate: #form.advertizingCosts.Original.AdvertizingCostsDate[counter]#
Original Amount: #val(form.advertizingCosts.Original.Amount[counter])#
Original Details: #form.advertizingCosts.Original.Details[counter]#
Original StoreFrontName is #form.advertizingCosts.Original.StoreFrontName[counter]#
</pre>

<cfelse>

</cfif>
</cfoutput>
</cfloop>
</cfif>

The Amount data would end up going to the details column, the date appears as the amount on the second page. This page only displays values.

It looks to be correct, but I'm not sure what is causing the shifting.

Any help would be great!

Jason
TOPICS
Advanced techniques

Views

597

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 20, 2010 Apr 20, 2010

Copy link to clipboard

Copied

I recently had the same problem and couldn't fully solve it.

I got around it by placing that id column (select=no) at the end of the grid.

Then, it doesn't get hung up on it and shift column values.  Not a great result but it sort of works.

yeah, only took 2 years for a single person to reply...

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 ,
Oct 03, 2011 Oct 03, 2011

Copy link to clipboard

Copied

LATEST

This fixed it for me. Only do this if you have version 9.01 of coldfusion.

Open cfide/scripts/ajax/package/grid.js

find this line of code

var _5aa=$G.computeActualRow_editField(this.editFieldState,this.selectedRow);    (IT is in the $G.Actions.afterEdit=function(_5a8))

change it to

var _5aa=$G.computeActualRow_editField(this.editFieldState,_5a8.row+1);

every thing should now be in sync

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