国内外VPS
主机测评与优惠

bootstrapTable设置行样式(背景颜色)

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;  }

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《bootstrapTable设置行样式(背景颜色)》
文章链接:https://www.liuzhanwu.com/3147.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

登录

找回密码

注册