DHTMLX Docs & Samples Explorer

Get Item Type

Source
<script type="text/javascript" src="../../codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="../../codebase/dhtmlxtoolbar.js"></script>
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxtoolbar_dhx_skyblue.css"></link>
 
<div style="height: 150px;"><div id="toolbarObj"></div></div>
<select id="sel"></select><input type="button" value="Get Type" onclick="getType();">
<script>
var sel,
toolbar;
function doOnLoad() {
    sel = document.getElementById("sel");
    toolbar = new dhtmlXToolbarObject("toolbarObj");
    toolbar.setIconsPath("../common/imgs/");
    toolbar.loadXML("../common/dhxtoolbar.xml?etc=" + new Date().getTime(), function() {
        toolbar.forEachItem(function(id) {
            sel.options.add(new Option(id, id));
        });
    });
}
function getType() {
    var id = sel.options[sel.selectedIndex].value;
    alert(toolbar.getType(id));
}
</script>