Willis asked:
"Do you know how to disable or turn off the right mouse click menu for cfgrid?"
This is actually pretty easy, all you need to do is set up a listener on the contextmenu event and have the listener cancel the event. Here is the code (click here to try it):
<!--- build some test data (in reall life you would do
a query here or you would bind the grid to a CFC --->
<cfset MyQuery = querynew("POID,OrderDate")>
<cfset queryaddrow(MyQuery)>
<cfset querysetcell(myQuery,"POID","1")>
<cfset querysetcell(myQuery,"OrderDate","8/15/2007")>
<cfset queryaddrow(MyQuery)>
<cfset querysetcell(myQuery,"POID","2")>
<cfset querysetcell(myQuery,"OrderDate","8/16/2007")>
<html>
<head>
<!--- write a function to handle the right clicks (noRightClick)
and a function to set up the event listener (init) --->
<script language="JavaScript">
noRightClick = function(e){
e.stopEvent();
}
init = function() {
mygrid = ColdFusion.Grid.getGridObject('POGrid');
mygrid.on('contextmenu',noRightClick);
}
</script>
</head>
<body>
<!--- show it in a grid --->
<cfform name="PurchaseForm">
<cfgrid name="POGrid" query="MyQuery" format="html" autowidth="true" fontsize="10">
<cfgridcolumn name="poid" header="Order ID" select="true" display="true">
<cfgridcolumn name="OrderDate" header="Order Date">
</cfgrid>
</cfform>
<!--- use ajaxonload to ensure the function to set up the event listener
is called after the grid is loaded --->
<cfset ajaxOnLoad("init")>
</body>
</html>
There are no comments for this entry.
[Add Comment]