DHTMLX Docs & Samples Explorer

Attache events to Items

Events Log

Change Items Type

F-icon
F-titles
F-table
Source
<script src="../../codebase/dhtmlxdataview.js" type="text/javascript"></script>
   <script src="../../codebase/types/ftypes.js" type="text/javascript"></script>
   <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxdataview.css">  
   <link rel="STYLESHEET" type="text/css" href="../../codebase/types/ftypes.css">  
<script>
var data;
function doOnLoad() {
    data = new dhtmlXDataView("data_container");
    changeType("ficon");
    data.load("../common/files_ext.xml");
    data.attachEvent("onItemDblClick", function(itemId) {
        setStatus("dblclick. Item :: " + data.get(itemId).name);
    });
    data.attachEvent("onItemClick", function(itemId) {
        setStatus("click. Item :: " + data.get(itemId).name);
    });
}
function changeType(type) {
    data.define("type", type);
    data.customize({
        icons_src_dir: "../common/images";
    });
}
function setStatus(str) {
    document.getElementById("stat").innerHTML += str + "<br>";
}
</script> </script> <div style="position:relative;"> <img src="../common/images/samples_frame.gif" width="436" height="513" alt="" border="0"> <div id="data_container" style="width:396px;height:400px;overflow:hidden;position:absolute;top:65px;left:20px;border:0px solid red;"></div> <div id="stat" style="position:absolute;left:450px;top:10px"><h3>Events Log</h3></div> </div> <h3>Change Items Type</h3> <input type="radio" name="switch" onclick="changeType(this.value)" value="ficon" checked> F-icon<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftiles"> F-titles<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftable"> F-table<br>