Bootstrap table文本太长溢出隐藏,鼠标停显示文本内容。
效果如上图所示。
首先想到的是html的title样式,是最常用的,但是无奈bootstrap table的html都是封装好的,想要修改源码不可能完全获取dom元素进行更改,这样改太过于麻烦且出错率比较高。所以我网上找了一些资料来实现这个功能。
1.在bootstrap table配置部分的columns里如下写:
columns: [
{
field : “region_total_name”,
title : ‘区域’,
cellStyle:formatTableUnit,
formatter :paramsMatter
}
]
2.定义方法:
//表格超出宽度鼠标悬停显示td内容
function paramsMatter(value,row,index, field) {
var span=doc