美文网首页
bootstrap-table方法

bootstrap-table方法

作者: 前端来入坑 | 来源:发表于2021-09-23 21:25 被阅读0次
  • 初始化表格
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) { // 列计算函数showFooter:true显示
      var sum = 0;
      return sum;
    },
  }]
}
$('#bootstrap-table').bootstrapTable(tableOptions);
  • 销毁表格
$('#bootstrap-table').bootstrapTable('destroy');
  • 刷新表格
$("#bootstrap-table").bootstrapTable('refresh');
  • 获取选中行数据
$('#bootstrap-table').bootstrapTable('getSelections');
  • 获取所有行数据
$('#bootstrap-table').bootstrapTable('getData');
  • 添加请求参数
tableOptions.queryParams = tableOptions.queryParams ? tableOptions.queryParams : {};
tableOptions.queryParams.name= 'myName';

Bootstrap表格方法-小书童文档

选择行 得到全部数据 底部总分统计

相关文章

网友评论

      本文标题:bootstrap-table方法

      本文链接:https://www.haomeiwen.com/subject/tbdsiltx.html