<!--bootstrap-table表格-->
<table id="table">
<thead style="background:#efefef;">
<tr>
<th data-checkbox="true"></th>
<th data-field="index" data-formatter="indexFormatter">序号</th>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>
获得 bootstrapTable行号index
$("#table").on("click-row.bs.table",function(e, row, $element){
var index = $element.data('index') + 1;
alert(index);
});
自动生成bootstrapTable行号index(每页都从1开始)
//table序号。
function indexFormatter(value, row, index) {
return index + 1;
};
自动生成bootstrapTable行号index(连续的行号,比如每页10行,第二页从11开始)
说明: _params 是自定义ajax方法的参数副本BootstrapTable自定义ajax方法
//table序号。
function indexFormatter(value, row, index) {
return _params.data.offset + index + 1;
};