Dragon
主机之家测评主机之家测评  2019-08-27 07:44 主机之家测评 隐藏边栏 |   抢沙发  625 
文章评分 0 次,平均分 0.0

bootstrap table 定义代码:

  $table.bootstrapTable({      showExport: true,      height: 540,      rowStyle:rowStyle,//通过自定义函数设置行样式      columns: [          {              field: 'id',              title: '序号',              align: 'center',              sortable: true          }, {              field: 'sid',              title: '学号',              align: 'center'          },      ]  });

bootstrapTable 设置行样式(背景颜色)函数 1:通过调用 bootstrap 默认的样式来设置指定行的背景颜色

  function rowStyle(row, index) {      var classes = ['active', 'success', 'info', 'warning', 'danger'];      if (index % 2 === 0 && index / 2 < classes.length) {          return {              classes: classes[index / 2]          };      }      return {};  }  

bootstrapTable 设置行样式(背景颜色)函数 2:调用自定义样式设置指定行的字体颜色

  function rowStyle(row, index) {      var style = {};                  style={css:{'color':'#ed5565'}};                     return style;  }

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

发表评论

扫一扫二维码分享