<cfwindow
closable="true"
draggable="true"
height="300"
name="YourCFWindowName"
resizable="false"
title="My Window"
width="300"
x="100"
y="100"
>
<table><tr><td>YAY! It works :-)</td></tr></table>
</cfwindow>
<script>
init=function(){
grid = ColdFusion.Grid.getGridObject("YourGridName");
grid.addListener("rowdblclick",showWin);
}
function showWin(){
ColdFusion.Window.show('YourCFWindowName')
}
</script>
<cfset ajaxOnLoad("init")>
<!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=utf-8" />
<title>How to open a cfwindow on double click of a grid row</title>
<script>
init=function(){
grid = ColdFusion.Grid.getGridObject("YourGridName");
grid.addListener("rowdblclick",showWin);
}
function showWin(){
ColdFusion.Window.show('YourCFWindowName')
}
</script>
</head>
<body>
<cfform name="YourGridFormName">
<!--- Replace the following cfgrid with your cfgrid, this one is only here as a placeholder --->
<cfgrid name="YourGridName"
format="html"
pagesize="25"
striperows="yes"
gridlines="yes"
selectmode="row"
bind="cfc:yourCFC_Name.yourLoadFunctionName({cfgridpage},
{cfgridpagesize},
{cfgridsortcolumn},
{cfgridsortdirection})"
onchange="cfc:yourCFC_Name.yourFunctionName({cfgridaction},
{cfgridrow},
{cfgridchanged})">
<cfgridcolumn name="myCol1" header="Column 1" width="100"/>
<cfgridcolumn name="myCol2" header="Column 2" width="100"/>
<cfgridcolumn name="myCol3" header="Column 3" width="100"/>
</cfgrid>
</cfform>
<cfwindow
closable="true"
draggable="true"
height="300"
name="YourCFWindowName"
resizable="false"
title="My Window"
width="300"
x="100"
y="100"
>
<table><tr><td>YAY! It works :-)</td></tr></table>
</cfwindow>
<cfset ajaxOnLoad("init")>
</body>
</html>
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (6)
Author
Commented:However if you are just trying to display the row data in a form, you could use a cfajaxproxy and bind the form to the grid row so on click it shows the window and changes the form data to that specific row...
<cfajaxproxy bind="javascript:someFunct
Commented:
Commented:
Commented:
Commented:
I have created a Tutorial on this and Will post it here, it may take some time for Approval
Cheers
View More