DHTML JavaScript Grid 初始化加载示例:
<div id="gridbox" width="100%" height="250px" style="background-color:white;overflow:hidden"></div>
----方法一:--html/JSP页面中:-------------------------------
<script>
mygrid = new dhtmlXGridObject('gridbox');//生成一个初始化对象
mygrid.setImagePath("../imgs/"); //添加图片
mygrid.setHeader("Column A, Column B");//添加表头
mygrid.setInitWidths("100,250"); //设置表列的宽度
mygrid.setColAlign("right,left"); //设置列的文本对齐样式
mygrid.setColTypes("ro,ed"); //设置文本的编辑格式
mygrid.setColSorting("int,str");//设置排序
mygrid.enableMultiselect(true);//可选择多行
mygrid.init();
mygrid.loadXML("../grid.xml"); //加载XML文件
</script>
--方法二:----XML页面中:-------------------------------
<rows>
<head>
<column width="150" type="ro" align="center" color="#F5F5F5" sort="na">资产</column>
<column width="200" type="ro" align="left" sort="na">账面价值</column>
<column width="100" type="zs" align="right" sort="na">清算价值</column>
<column width="100" type="math" align="right" sort="na">#cspan</column>
<column width="100" type="math" align="right" sort="na">#cspan</column>
<column width="200" type="math" align="right" sort="na">操作</column>
<column width="200" type="zs" align="right" sort="na">备注</column>
<afterInit>
<call command="attachHeader">
<param><![CDATA[#rspan,#rspan,详评,未详评,合计,#rspan,#rspan]]></param>
</call>
</afterInit>
</head>
<row id="1">
<cell><![CDATA[1]]></cell>
<cell title=""><![CDATA[资产估值合计]]></cell>
<cell type="plus">88</cell>
<cell></cell>
<cell></cell>
<cell></cell>
<cell></cell>
</row>
</rows>