xml/json formats for buttonTwoState

from xml from json
<item
	id       = "open"		// required, will generated automatically if empty
	type     = "buttonTwoState"	// required, item type
	img      = "open.gif"		// optional, icon for enabled item
	imgdis   = "open_dis.gif"	// optional, icon for disabled image
	text     = "Open"		// optional, item text
	title    = "Tooltip here"	// optional, tooltip for item
	enabled  = "false"		// optional, disable item
	hidden   = "true"		// optional, hide item
	action   = "function_name"	// optional, function name to exec on click
	selected = "true"		// optional, pressed on init
>
	// optional, userdata
	<userdata name="p1">value1</userdata>
	<userdata name="p2">value2</userdata>
</item>
{
	id:       "open"		// required, will generated automatically if empty
	type:     "buttonTwoState"	// required, item type
	img:      "open.gif"		// optional, icon for enabled item
	imgdis:   "open_dis.gif"	// optional, icon for disabled image
	text:     "Open"		// optional, item text
	title:    "Tooltip here"	// optional, tooltip for item
	enabled:  false			// optional, disable item
	hidden:   true			// optional, hide item
	action:   "function_name"	// optional, function name to exec on click
	selected: true			// optional, pressed on init
	userdata: {			// optional, userdata
		p1: "value1"		// userdara, name:value pairs
		p2: "value2"
	}

	// deprecated:

	img_disabled: "open_dis.gif"	// => imgdis:   "open_dis.gif"
	disabled:     true		// => enabled:  false
	pressed:      true		// => selected: true
}
The purpose of this demo is to show you list of available xml and json attributes in action
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>xml/json formats for buttonTwoState</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>
		table.my_table td {
			text-align: left;
			vertical-align: top;
			padding-right: 20px;
			padding-bottom: 10px;
			font-family: Tahoma;
		}
		table.my_table td.item_type {
			height: 20px;
			font-size: 12px;
			vertical-align: middle;
		}
		pre.my_code {
			font-size: 11px;
		}
	</style>
	<script>
		var myToolbarXML;
		var myToolbarJSON;
		function doOnLoad() {
			myToolbarXML = new dhtmlXToolbarObject({
				parent: "toolbarObjXML",
				icons_path: "../common/imgs/",
				xml: "../common/all_items/button_two_state.xml",
				onload: function(){logUserData("myToolbarXML", this);}
			});
			myToolbarJSON = new dhtmlXToolbarObject({
				parent: "toolbarObjJSON",
				icons_path: "../common/imgs/",
				json: "../common/all_items/button_two_state.json",
				onload: function(){logUserData("myToolbarJSON", this);}
			});
		}
		function myFunction(id) {
			// console.log("myFunction called", arguments);
		}
		function logUserData(tbName, tbInst) {
			var userData = {
				my_data_name: tbInst.getUserData("open", "my_data_name"),
				more_info: tbInst.getUserData("open", "more_info")
			};
			// console.log(tbName, userData);
		}
	</script>
</head>
<body onload="doOnLoad();">
	<table border="0" cellspacing="0" cellpadding="0" class="my_table" width="100%">
		<tr>
			<td width="50%">from xml</td>
			<td width="50%">from json</td>
		</tr>
		<tr>
			<td><div style="height: 150px;"><div id="toolbarObjXML"></div></div></td>
			<td><div style="height: 150px;"><div id="toolbarObjJSON"></div></div></td>
		</tr>
		<tr>
			<td>
<pre class="my_code">&lt;item
	id       = "open"		// required, will generated automatically if empty
	type     = "buttonTwoState"	// required, item type
	img      = "open.gif"		// optional, icon for enabled item
	imgdis   = "open_dis.gif"	// optional, icon for disabled image
	text     = "Open"		// optional, item text
	title    = "Tooltip here"	// optional, tooltip for item
	enabled  = "false"		// optional, disable item
	hidden   = "true"		// optional, hide item
	action   = "function_name"	// optional, function name to exec on click
	selected = "true"		// optional, pressed on init
&gt;
	// optional, userdata
	&lt;userdata name="p1"&gt;value1&lt;/userdata&gt;
	&lt;userdata name="p2"&gt;value2&lt;/userdata&gt;
&lt;/item&gt;</pre>
			</td>
			<td>
<pre class="my_code">{
	id:       "open"		// required, will generated automatically if empty
	type:     "buttonTwoState"	// required, item type
	img:      "open.gif"		// optional, icon for enabled item
	imgdis:   "open_dis.gif"	// optional, icon for disabled image
	text:     "Open"		// optional, item text
	title:    "Tooltip here"	// optional, tooltip for item
	enabled:  false			// optional, disable item
	hidden:   true			// optional, hide item
	action:   "function_name"	// optional, function name to exec on click
	selected: true			// optional, pressed on init
	userdata: {			// optional, userdata
		p1: "value1"		// userdara, name:value pairs
		p2: "value2"
	}

	// deprecated:

	img_disabled: "open_dis.gif"	// => imgdis:   "open_dis.gif"
	disabled:     true		// => enabled:  false
	pressed:      true		// => selected: true
}</pre>
			</td>
		</tr>
	</table>
	<div>
		The purpose of this demo is to show you list of available xml and json attributes in action
	</div>
</body>
</html>

Documentation

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