Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 741

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Example: editing data in a grid
The following example creates an editable grid. For code brevity, the example handles only three of the fields in the
Employee table. A more realistic example would include, at a minimum, all seven table fields. It can also hide the
contents of the Emp_ID column or display the Department name (from the Departmt table), instead of the
Department ID.
Create the editable grid
1
Create a ColdFusion page with the following content:
<cfquery name="empdata" datasource="cfdocexamples">
SELECT * FROM Employee
</cfquery>
<cfform name="GridForm"
action="handle_grid.cfm">
<cfgrid name="employee_grid"
height=425
width=300
vspace=10
selectmode="edit"
query="empdata"
insert="Yes"
delete="Yes">
<cfgridcolumn name="Emp_ID"
header="Emp ID"
width=50
headeralign="center"
headerbold="Yes"
select="No">
<cfgridcolumn name="LastName"
header="Last Name"
width=100
headeralign="center"
headerbold="Yes">
<cfgridcolumn name="Dept_ID"
header="Dept"
width=35
headeralign="center"
headerbold="Yes">
</cfgrid>
<br>
<cfinput name="submitit" type="Submit" value="Submit">
</cfform>
Save the file as grid2.cfm.
2
3
View the results in your browser.
Reviewing the code
The following table describes the code and its function:
Last updated 1/20/2012
736

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents