合并 Bootstrap Table 中的单元格
Merging Cells in Bootstrap Table
我在 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 示例。
我在 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 示例。