首页 > 技术文章 > bootsraptable 字段超出用省略号代替,更改字号大小

meili970202 2021-06-05 08:36 原文

<div class="tablebox" style="padding: 1px">
<table id="table" style="table-layout:fixed;"></table>
</div>


-------------------------------

<script type="text/javascript">
//表格超出宽度鼠标悬停显示td内容
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}

//td宽度以及内容超过宽度隐藏
function formatTableUnit(value, row, index) {
return {
css: {
"white-space": "nowrap",
"text-overflow": "ellipsis",
"overflow": "hidden",
{#"max-width":"150px",#}
"font-size": "11px"
}
}
}
</script>

----------------------------------
columns: [{
field: 'event_time',
title: '报警时间',
align: 'center',
valign: 'middle',
cellStyle: formatTableUnit,
formatter: paramsMatter
}

推荐阅读