我在合并Bootstrap表中的单元时遇到了麻烦,我在这里找到了一个示例。
但是我不希望通过单击按钮来执行合并,而是希望自动合并。
这是我的代码:
<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示例。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句