Auto-adjust item


</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Auto-adjust item</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 type="text/css">
		.dhx_dataview .dhx_dataview_item{
			border-width:0px;
		}
	</style>
	<script>
		var myDataView;
		function changeCols(n){
			myDataView.config.autowidth = n;
			myDataView.refresh();
		}
		function doOnLoad() {
			myLayout = new dhtmlXLayoutObject({
				parent: "layoutObj",
				pattern: "3L",
				cells: [{id: "a", text: "dhtmlxDataView", width: 410}]
			});

			myDataView = myLayout.cells("a").attachDataView({
				container:"data_container",
				width:300,
				type:{
					template:"<span class='dhx_strong'>#Maintainer#</span>#Package#<br><span class='dhx_light'>#Version#</span>",
					height:55, padding:10, margin:2, border:1
				},
				autowidth:2,

			});
			myDataView.load("../common/data.xml");
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h1>Auto-adjust item size to a container</h1>
	<div id="layoutObj" style="width:800px;height:396px;"></div>
	<br>
	<input type="button" value="2 columns" onclick='changeCols(2)'>
	<input type="button" value="3 columns" onclick='changeCols(3)'>
	<input type="button" value="4 columns" onclick='changeCols(4)'>
</body>
</html>

Documentation

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