1

I've been asked to use cfGrid to allow the editing of an uploaded spreadsheet before final commit to the database. I was familiar with cfGrid back in the CF 5/6 days, but have not used it recently. So I may simply be misinterpreting the data.

My grid call is as follows:

    <cfgrid name="uGrid"
        format="html" 
        query="xlsData"
        title="Edit Uploaded Data" 
        striperows="yes"
        selectmode="edit"
        delete="yes">
            <cfgridcolumn name="queryRowNum" display="true" />
            <cfloop list="#replace(form.columnList, " ", "", "All")#" index="i">
                <cfgridcolumn name="#i#" header="#i#" width="200" select="Yes" />
            </cfloop>
   </cfgrid>

I upload the following data which appears properly in the grid:

    QueryRowNum profileID   speakingDate
    1   1   1/1/2014
    2   2   1/15/2014
    3   3   3/7/2014
    4   5   5/9/2014
    5   6   11/8/2014

I change the data on line one to 1/10/2014 and the date on line 3 to 3/17/2014 and then submit the grid. On the next page I dump the form scope so I can see what cfGrid is passing along. I plan to look through the arrays passed in to do my updates. This is what I see in the form scope:

    UGRID.QUERYROWNUM   
    array
    1   3
    2   4
    UGRID.ROWSTATUS.ACTION  
    array
    1   U
    2   U
    UGRID.SPEAKINGDATE  
    array
    1   1/10/14
    2   3/17/14

I would instead expect this:

    UGRID.QUERYROWNUM   
    array
    1   1
    2   3
    UGRID.ROWSTATUS.ACTION  
    array
    1   U
    2   U
    UGRID.SPEAKINGDATE  
    array
    1   1/10/14
    2   3/17/14

My expectation (based on the docs) is that any row that is changed will have that entire row passed along. I can then use the "queryRowNum" array to know which query row will need updated with the new data. Since I updated the first row and the third row, and those have a queryRowNum of 1 and 3 respectively, I would have expected that in the uGrid.QueryRowNum array.

Is this assumption incorrect? If so, how do I know what query row to update?

This server is running, I believe, CF9.

EDIT

Oddly, I just noticed that I can change what is passed along in the unchanged columns based upon what cell I have selected when I click the submit button. If I select the column I changed in the first row and submit the form then everything works correctly.

Nicholas
  • 1,974
  • 4
  • 20
  • 46

1 Answers1

0

I also have noticed this odd behavior. I haven't found a solution for the "html" format. The workaround i've used is the "flash" format. The one change from HTML to flash sends all of the correct data.

<cfif isdefined('form.submit')>
    <cfdump ="#form1#">
    <cfgridupdate grid = "uGrid" dataSource = "#DSN" tableName = "#tablename#" keyOnly="true"  >
</cfif>

<cfquery name="xlsData">    
</cfquery>

<cfform name="form1" action="#cgi.script_name#" format="flash" method="post">

<cfgrid name="uGrid"
            format="flash" 
            query="xlsData"
            title="Edit Uploaded Data" 
            striperows="yes"
            selectmode="edit"
            delete="yes">

            <cfgridcolumn name="queryRowNum" display="true" />
            <cfloop list="#replace(form.columnList, " ", "", "All")#" index="i">
                    <cfgridcolumn name="#i#" header="#i#" width="200" select="Yes" />
            </cfloop>
    </cfgrid>
    <cfinput name="submit" type="Submit" value="Save All Changes">
</cfform>