[英]bootstrap-table: th - add on the left an icon
有谁知道如何在bootstrap-table标头左侧添加一些内容? 就像下面的图片一样,我想添加一个图标(问号或其他符号)以使其成为可点击的链接。
<table id="summaryTable">
<thead>
<tr>
<th data-field="id" data-align="center" data-width="20px" >id</th>
<th data-field="name" data-align="center" data-sortable="true">Name</th>
<th data-field="type" data-align="center" data-sortable="true">type</th>
</tr>
</thead>
</table>
您可以将元素添加到每个th
:
$('#summaryTable thead th').each(function() {
s = $('<span style="position: absolute; left: 4px; top: 8px; cursor: pointer;">?</span>')
s.click(function(e) {
e.stopPropagation();
alert('Question mark clicked')
});
$(this).append(s)
})
注意
e.stopPropagation();
确保点击问号不会导致点击整个TH
这是您的jsfiddle的一个分支:
https://jsfiddle.net/dekelb/e403uvuh/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.