我在合并 Bootstrap Table 中的单元格时遇到问题 我找到了一个例子here .
但我不希望通过单击按钮来执行合并,而是希望自动合并。
这是我的代码:
<table id='ViewTable'
data-toggle='table'
data-url='func/json.php?id=1'
data-class='table table-hover table-condensed'
data-striped='true'
data-show-header='false'>
<thead>
<tr>
<th data-field='picture'></th>
<th data-field='description'></th>
<th data-field='value'></th>
</tr>
</thead>
</table>
<script>
$(document).ready(function() {
$('#ViewTable').bootstrapTable('mergeCells', {
index: 0,
field: 'picture',
rowspan: 12
});
});
</script>
有什么建议吗?
最佳答案
您可以使用 post-body.bs.table
事件来执行您想要的操作:
var $table = $('#ViewTable');
$(function () {
$table.on('post-body.bs.table', function () {
$table.bootstrapTable('mergeCells', {
index: 0,
field: 'picture',
rowspan: 12
});
});
});
这是一个jsFiddle示例。
关于css - 合并 Bootstrap 表中的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29864914/