Listed option text

</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Listed option text</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 sel2;
		var myToolbar;
		function doOnLoad() {
			sel2 = document.getElementById("sel2");
			myToolbar = new dhtmlXToolbarObject({
				parent: "toolbarObj",
				icons_path: "../common/imgs/",
				xml: "../common/dhxtoolbar_buttonselect.xml",
				onload: updateList
			});
		}
		function getId() {
			var id = (sel2.options[sel2.selectedIndex].value).split(";");
			return id;
		}
		function setText(text) {
			var id = getId();
			myToolbar.setListOptionText(id[0], id[1], document.getElementById("txt").value);
		}
		function getText() {
			var id = getId();
			alert(myToolbar.getListOptionText(id[0], id[1]));
		}
		function updateList() {
			sel2.options.length = 0;
			myToolbar.forEachItem(function(itemId){
				if (myToolbar.getType(itemId) == "buttonSelect") {
					myToolbar.forEachListOption(itemId, function(listId){
						if (myToolbar.getTypeExt(listId) != "separator") {
							sel2.options.add(new Option(itemId+" - "+listId, itemId+";"+listId));
						}
					});
				}
			});
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div id="toolbarObj"></div>
	<div style="margin-top: 200px;">
		<select id="sel2"></select>
		<input type="button" value="Get Text" onclick="getText();">
		<input type="button" value="Set Text" onclick="setText();">
		<input id="txt" type="text" value="New Text">
	</div>
</body>
</html>

Documentation

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