我正在使用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部门-_-,绑定不起作用)
答案 0 :(得分:3)
你会这样(来自CF live docs)。如果gridEntered表单字段存在,表单就会被提交。执行gridupdate。
<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
示例代码应该稍微清理一下:在IsDefined上使用StructKeyExists(Form,“gridEntered”)(“form.gridEntered”)