DHTMLX 前端框架 建立你的一个应用程序 教程(五)--添加一个表格Grid

 

表格例子

 

  样本如下:

  

  我们这篇介绍的是dhtmlxGrid  组件。 它支持4种数据格式:XML, JSON, CSV, JSArray.

 

添加表格到布局的单元格中去:

  

  1.使用attachGrid() 方法将表格添加到布局的单元格中去。

  

 var layout = new dhtmlXLayoutObject(document.body,"2U");
 var contactsGrid = layout.cells("a").attachGrid();

 

  2.继续添加代码 进行gird的初始化设置:

  

contactsGrid.setHeader("Name,Last Name,Email");   //sets the headers of columns
contactsGrid.setColumnIds("fname,lname,email");         //sets the columns' ids
contactsGrid.setInitWidths("250,250,*");   //sets the initial widths of columns
contactsGrid.setColAlign("left,left,left");     //sets the alignment of columns
contactsGrid.setColTypes("ro,ro,ro");               //sets the types of columns
contactsGrid.setColSorting("str,str,str");  //sets the sorting types of columns

 

  3.用init() 方法进行表格的初始化

  

contactsGrid.init();

 

  

转载于:https://www.cnblogs.com/DemoLee/p/4032272.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值