Custom icons from script

custom icons from script
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Custom icons from script</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>
	<style>
		div.sample_info_here {
			position: relative;
			width: auto;
			margin: 20px;
			font-family: Roboto, Arial, Helvetica;
			font-size: 14px;
			color: #404040;
		}
		div.sample_info_here div.sample_info_title {
			line-height: 18px;
			font-size: 15px;
			color: #3b5e7c;
		}
		div#tree_here {
			position: relative;
			border: 1px solid #dfdfdf;
			box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.09);
			width: 350px;
			height: 400px;
			margin-left: 20px;
			margin-bottom: 20px;
		}
		/* css for custom icons */
		.icon_book {
			background-image: url(../common/custom_icons/book.gif);
		}
		.icon_safe_closed {
			background-image: url(../common/custom_icons/safe_closed.gif);
		}
		.icon_safe_opened {
			background-image: url(../common/custom_icons/safe_opened.gif);
		}
		.icon_text {
			background-image: url(../common/custom_icons/icon_text.gif);
		}
		.icon_graph {
			background-image: url(../common/custom_icons/icon_graph.gif);
		}
	</style>
	<script>
		var myTreeView;
		function doOnLoad() {
			myTreeView = new dhtmlXTreeView({
				parent: "tree_here",
				json: "../common/treeview_font_awesome.json",
				onload: function() {
					// update icons
					myTreeView.setItemIcons("1", {folder_opened: "icon_safe_opened", folder_closed: "icon_safe_closed"});
					myTreeView.setItemIcons("2", {folder_opened: "icon_safe_opened", folder_closed: "icon_safe_closed"});
					myTreeView.setItemIcons("3", {file: "icon_book"});
					myTreeView.setItemIcons("4", {file: "icon_book"});
					myTreeView.setItemIcons("5", {file: "icon_book"});
					myTreeView.setItemIcons("6", {file: "icon_book"});
					myTreeView.setItemIcons("7", {file: "icon_book"});
					myTreeView.setItemIcons("8", {file: "icon_graph"});
					myTreeView.setItemIcons("9", {file: "icon_text"});
				}
			});
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div class="sample_info_here">
		<div class="sample_info_title">custom icons from script</div>
	</div>
	<div id="tree_here"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.