DHTMLX Docs & Samples Explorer

Constructor of dhtmlxGrid

        var mytree = new dhtmlXGridObject(parent)

where

  • parent - id of HTML element which will be used as parent ( or html object itself )
      <div id='my_grid_here' style="width:500px; height:100px;"></div>
      <script>
      //common init code
      var mygrid = new dhtmlXGridObject("my_grid_here");
      </script>

Layout, Window, Accordion, Tabbar can create a grid inside their cells by using

      var mygrid = some_component.cells(some_id).attachGrid()

Starting from 2.5 version, grid can be initialized by object notation

      var mygrid = new dhtmlXGridObject({
          some_option1:some_value_1,
          some_option2:some_value_2,
          ...
          some_optionN:some_value_N,
      })

List of supported options

The columns can be defined as

	agrid = new dhtmlXGridObject({
		parent:"a_grid",
		image_path:"codebase/imgs",
		columns:[
			{ label: "Sales",           width:50, 	type:"ed" },
			{ label:["Book title",
				 "#text_filter"],   width:150, 	type:"ed" },
			{ label:["Author",
				 "#select_filter"], width:150, 	type:"ed" },
			{ label: "Price",       width:50, 	type:"ed" },
			{ label:"In store" , 	width:80, 	type:"ch" },
			{ label:"Shipping" , 	width:50, 	type:"ed" },
			{ label:"Bestseller" , 	width:50, 	type:"ed" },
			{ label:"Date" , 	width:50, 	type:"ed" }
		],
 
		xml:"data.xml"
	});