Edit actions
There is an opportunity to define edit operations:
Edit on click
Edit on double click
Edit on F2 key
Selected row:
|
</> Source
<!DOCTYPE html>
<!--pro-->
<html>
<head>
<title>Edit actions</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<script>
var myGrid;
function doOnLoad(){
myGrid = new dhtmlXGridObject('gridbox');
myGrid.setImagePath("../../../codebase/imgs/");
myGrid.setHeader("Sales,Book Title,Author,Price,In Store,Shipping,Bestseller,Date of Publication");
myGrid.setInitWidths("80,150,100,80,80,80,80,100");
myGrid.setColAlign("right,left,left,right,center,left,center,center");
myGrid.setColTypes("dyn,ed,ed,price,ch,co,ra,ro");
myGrid.enableEditEvents(false,true,true);
myGrid.attachEvent("onRowSelect",doOnRowSelect);
var combobox = myGrid.getCombo(5);
combobox.put("1","1 Hour");
combobox.put("12","12 Hours");
combobox.put("24","24 Hours");
combobox.put("48","2 days");
combobox.put("168","1 week");
combobox.put("pick","pick up");
combobox.put("na","na");
myGrid.setColSorting("int,str,str,int,str,str,str,date");
myGrid.enableAutoWidth(true);
myGrid.enableAutoHeight(true);
myGrid.init();
myGrid.load("../common/grid.xml");
}
function doOnRowSelect(id){
document.getElementById("logBox").innerHTML="Selected row: "+id;
}
function doEditEvents(){
myGrid.enableEditEvents(document.getElementById('z1').checked,document.getElementById('z2').checked,document.getElementById('z3').checked);
}
</script>
</head>
<body onload="doOnLoad()">
<h1>Edit actions</h1>
<p>There is an opportunity to define edit operations:</p>
<table width="600">
<tr>
<td width="50%" valign="top">
<div id="gridbox" style="width:750px;height:350px;overflow:hidden"></div>
</td>
</tr>
<tr>
<td>
<div><input id='z1' type="checkbox" onclick='doEditEvents()'>Edit on click</div>
<div><input id='z2' type="checkbox" checked='true' onclick='doEditEvents()'>Edit on double click</div>
<div><input id='z3' type="checkbox" checked='true' onclick='doEditEvents()'>Edit on F2 key</div>
<div id='logBox'>Selected row:</div>
</td>
</tr>
</table>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.