|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Flash Form - addItem to cfgrid?
Hi all, I'm building my first complicated Flash Form.
In my example I start with an editable cfgrid formed via a query. Secondly there are two cfinput boxes bound to the grid. A cfselect follows (formed via a different query). Finally, I have a second cfgrid formed via a third query. What I'd like to do - 1) User selects item in the first cfgrid - values are bound to the two cfinput boxes. 2) User selects an item in the cfselect box. 3) User clicks a button to copy these three values to the second cfgrid. I know the button requires addItem (?), but the farthest I can get with addItem is for it to add an empty row in he grid. Any values I pass on are not copied. Could someone take me through this? |
|
#2
|
|||
|
|||
|
Some code I'm working with:
Code:
<cfquery name="qryNames" datasource="cmntmgmt">
SELECT names.nameID, names.first, names.last, names.phone, names.departmentID, departments.departmentID, departments.department
FROM names, departments
</cfquery>
<cfquery name="qryRoles" datasource="cmntmgmt">
SELECT roleID, role
FROM roles
</cfquery>
<cfquery name="qryRoleJoin" datasource="cmntmgmt">
SELECT roles.roleID, roles.role, rolejoin.rolejoinID, rolejoin.projectID, rolejoin.nameID, rolejoin.roleID, names.nameID, names.first, names.last, projects.projectID, projects.title
FROM roles, rolejoin, names, projects
WHERE roles.roleID = rolejoin.roleID AND names.nameID = rolejoin.nameID AND projects.projectID = rolejoin.projectID
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<cfform format="flash">
<cfformgroup type="vbox">
<cfgrid name="GridqryNames" query="qryNames" rowheaders="yes" width="700" height="200" insert="yes" delete="yes" selectmode="edit">
<!--- hidden --->
<cfgridcolumn name="nameID" display="no" select="no">
<!--- display --->
<cfgridcolumn name="first" header="First Name">
<cfgridcolumn name="last" header="Last Name">
<cfgridcolumn name="phone" header="Phone" mask="999-999-9999">
<cfgridcolumn name="department" header="Department" select="no">
</cfgrid>
</cfformgroup>
<cfformgroup type="vbox">
<!--- hidden --->
<cfinput type="text" label="" name="rolesNameID" visible="no" required="no" width="200" bind="{GridqryNames.selectedItem.nameID}">
<!--- display --->
<cfinput type="text" label="First" name="rolesFirst" required="no" width="200" bind="{GridqryNames.selectedItem.first}">
<cfinput type="text" label="Last" name="rolesLast" required="no" width="200" bind="{GridqryNames.selectedItem.last}">
<cfselect label="Role" name="roleslist" query="qryRoles" required="no" width="200" display="role" value="roleID"></cfselect>
<cfinput type="button" name="addrolebtn" value="Add Role" onClick="<!--- some type of addItem code goes here --->">
</cfformgroup>
<cfformgroup type="vbox">
<cfgrid name="GridRoles" query="qryRoleJoin" rowheaders="yes" width="500" height="200" delete="yes" insert="yes">
<!--- hidden --->
<cfgridcolumn name="roleID" display="no">
<cfgridcolumn name="projectID" display="no">
<cfgridcolumn name="nameID" display="no" >
<!--- display --->
<cfgridcolumn name="title" header="Project Name">
<cfgridcolumn name="first" header="First Name">
<cfgridcolumn name="last" header="Last Name">
<cfgridcolumn name="role" header="Role">
</cfgrid>
</cfformgroup>
</cfform>
<body>
</body>
</html>
|
|
#3
|
|||
|
|||
|
OK - got this to work with the following code in the Add Role button:
onClick="GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'rolesFirst', rolesFirst.text); GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'rolesLast', rolesLast.text); GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'role', role.text);" |
|
#4
|
|||
|
|||
|
Nice, this will be handy to know when I have the chance to mess with the Flash grid.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#5
|
|||
|
|||
|
Quote:
np - I'm really finding some of the limitations in Flash Forms to be quite annoying - only because flash forms are so cool! I really need to get a better grasp of the AS actions and how they work... Something that still doesn't work tho... - I'm still trying to add a line to the grid without doing it manually. i.e., in its current form, the user still has to click "Insert" on the cfgrid, then with that new line selected, the user clicks the Add Role button. I've tried the following additional code, but it only enters empty rows. If anyone knows how to accomplish this, let me know!! Code:
onClick="GridRoles.addItem(); GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'rolesFirst', rolesFirst.text); GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'rolesLast', rolesLast.text); GridRoles.dataProvider.editField(GridRoles.selectedIndex, 'role', role.text);" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Flash Form - addItem to cfgrid? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|