DHTMLX Docs & Samples Explorer

dhtmlxDataView Initialization

To init dataview, you need to

  1. include related js and css files
  2. place container for the dataview on a page
  3. run dataview initialiation

There are two files, which need to be included. Unless other dhtmlx components, dataview doesn't require dhtmlxcommon.js

<script src="../../codebase/dhtmlxdataview.js" type="text/javascript"></script>
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxdataview.css">

HTML container for the dataview, must have some sizes specified.

<div id="data_container" style="width:596px;height:396px;"></div>

While only “container” is mandatory, you need to define template and source of data to see any result on a page.

    view = new dhtmlXDataView({
		container:"data_container",
		type:{
	            template:"#Package# : #Version#<br/>#Maintainer#"
	        }
    });
    view.add({
        Package:"test one",
        Version:"0.1",
        Maintainer:"dhtmlx" 
    })

While add command is not mandatory part of init - you will not have any visible objects on page before data will not be loaded into dataview by load or add commands.