1

我正在使用 cfgrid 并且我不确定如何制作它,因此当有人在它保存的条目中编辑数据时。

<cfform>
<cfgrid
name = "degrees"
query = "getDegrees"
insert = "yes"
delete = "yes"
width = "500"
height = "150"
insertButton = "New Degree"
deleteButton = "Delete Degree"
colHeaderBold = "Yes"
selectColor = "##006633"
selectMode = "edit"
>
<cfgridcolumn name = "Terminal"
values = "Yes, No" >

<cfgridcolumn name = "Degree"
values = "B, M, D"
valuesDisplay = "Bachelors, Masters, Doctorate">
<cfgridcolumn name = "Name">

<cfgridcolumn name = "Specialization">
<cfgridcolumn name = "Year">
<cfgridcolumn name = "Institution">
<cfgridcolumn name = "Transcript"
values = "Yes, No" >

</cfgrid>
</cfform>

我知道有cfgridupdate标签,但我不确定放在哪里。它是否像常规表单一样提交?

我知道这是一个简单的问题,但我找不到不使用网络绑定的答案。(我不能使用......绑定它)

使用 Coldfusion 8。:) (注意:由于 IT 部门的原因,绑定不起作用 -_- )

4

1 回答 1

3

你会这样(来自 CF live docs)。如果 gridEntered 表单字段存在,则表单已提交。执行网格更新。

<cfif IsDefined("form.gridEntered") is True>
    <cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples" Keyonly="true"
        tableName = "CourseList">
 </cfif>


<cfform>
<cfgrid name = "FirstGrid" width = "450" 
    query = "GetCourses" insert = "Yes" delete = "Yes"
    font = "Tahoma" rowHeaders = "No" 
    colHeaderBold = "Yes" 
    selectMode = "EDIT"
    insertButton = "Insert a Row" deleteButton = "Delete selected row" >
</cfgrid><br>
<cfinput type="submit" name="gridEntered">
</cfform>

来源: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content= Part_3_CFML_Ref_1.html

The example code should be cleaned up a bit: Use StructKeyExists(Form,"gridEntered") over IsDefined("form.gridEntered")

于 2010-07-20T23:14:45.520 回答