码迷,mamicode.com
首页 > 其他好文 > 详细

handsontable合并表头

时间:2015-10-18 01:02:15      阅读:2500      评论:0      收藏:0      [点我收藏+]

标签:

想在页面中做类似excel的操作,发现handsontable符合要求。

然后发现这个文章

http://blog.csdn.net/wynan830/article/details/9054195

该作者扩展了handsontable实现了多表头。

同时添加了removeRowPlugin属性,作用是在每行前面显示一个删除按钮执行删除操作。

我的页面中不需要删除,因此把removeRowPlugin设置为false。但是表头出现了错行。

技术分享

查看生成的html发现,表头中多了一列:<th class="htNoFrame htRemoveRow"></th>。

在css中添加

.handsontable th.htNoFrame.htRemoveRow {
width:0px
}

不起作用。PS:我添加的这个CSS写法是不是有问题?

在jquery.handsontable.js里原作者添加了treeToth函数,处理多表头

原代码为:

datastr += ‘<tr>‘;
 datastr += ‘<th class="htNoFrame htRemoveRow"></th>‘;
 datastr += ‘<th ></th>‘;

可见没有判断是否需要显示删除按钮列

修改为:

datastr += ‘<tr>‘;
if (userSettings.removeRowPlugin != null && userSettings.removeRowPlugin) {
       datastr += ‘<th class="htNoFrame htRemoveRow"></th>‘;
   }
datastr += ‘<th ></th>‘;

 

handsontable合并表头

标签:

原文地址:http://www.cnblogs.com/darksied/p/4888719.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!