Text templates
From script
From JSON
you can set template by script or in json
From XML
you can set template by script or in xml
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Text templates</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.combo_info {
color: gray;
font-size: 11px;
padding-bottom: 5px;
padding-left: 2px;
font-family: Tahoma;
}
</style>
<script>
var myCombo, myCombo2, myCombo3;
function doOnLoad() {
// from script
myCombo = new dhtmlXCombo("combo_zone", null, null, "image");
myCombo.setImagePath("../common/flags/");
myCombo.enableFilteringMode(true);
myCombo.setTemplate({input: "#capital#", option: "#capital# - #country#"});
myCombo.addOption("1", {country: "Finland", capital: "Helsinki"}, null, "finland.png", true);
myCombo.addOption("2", {country: "Germany", capital: "Berlin"}, null, "germany.png");
myCombo.addOption("3", {country: "Great Britain", capital: "London"}, null, "britain.png");
myCombo.addOption("4", {country: "Hungary", capital: "Budapest"}, null, "hungary.png");
// from JSON
myCombo2 = new dhtmlXCombo("combo_zone2", null, null, "image");
myCombo2.setImagePath("../common/flags2/");
myCombo2.setDefaultImage("flag_green.png");
myCombo2.enableFilteringMode(true);
myCombo2.load("../common/data_consoles.json");
// from XML
myCombo3 = new dhtmlXCombo("combo_zone3", null, null, "image");
myCombo3.setImagePath("../common/flags2/");
myCombo3.setDefaultImage("flag_blue.png");
myCombo3.enableFilteringMode(true);
myCombo3.load("../common/data_os.xml");
}
</script>
</head>
<body onload="doOnLoad();">
<h3>From script</h3>
<div id="combo_zone" style="width:230px;"></div>
<br>
<h3>From JSON</h3>
<div class="combo_info">you can set template by script or in json</div>
<div id="combo_zone2" style="width:230px;"></div>
<br>
<h3>From XML</h3>
<div class="combo_info">you can set template by script or in xml</div>
<div id="combo_zone3" style="width:230px;"></div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.