- 初始化表格
var tableOptions = {
showFooter: true,
columns:[
{
checkbox: true
},{
field: 'name',
title: '昵稱',
width: '100px',
formatter: function(value, row, index) {
return "<div class='name'>自定義返回</div>"
},
cellStyle: function(){ // 定義單元格樣式
var css = { "color": "red"}
return { css: css }
},
footerFormatter: function (value) { // 列計算函數(shù)showFooter:true顯示
var sum = 0;
return sum;
},
}]
}
$('#bootstrap-table').bootstrapTable(tableOptions);
- 銷毀表格
$('#bootstrap-table').bootstrapTable('destroy');
- 刷新表格
$("#bootstrap-table").bootstrapTable('refresh');
- 獲取選中行數(shù)據(jù)
$('#bootstrap-table').bootstrapTable('getSelections');
- 獲取所有行數(shù)據(jù)
$('#bootstrap-table').bootstrapTable('getData');
- 添加請求參數(shù)
tableOptions.queryParams = tableOptions.queryParams ? tableOptions.queryParams : {};
tableOptions.queryParams.name= 'myName';
選擇行 得到全部數(shù)據(jù) 底部總分統(tǒng)計