zoukankan      html  css  js  c++  java
  • bootstrapTable设置行样式(背景颜色)

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

    2018-09-03 11:13:50 来源:原创 作者:寂静的神经 4471

    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;
    }
  • 相关阅读:
    分组背包(课题选择)
    和为n的俩个数的最大lcm
    合唱队形(悬线法)
    郊区春游(状压dp)
    三角形最大周长
    取余妹子数
    树形dp旅游
    L1-033 出生年
    L1-043 阅览室
    L1-044. 稳赢
  • 原文地址:https://www.cnblogs.com/grj001/p/12225234.html
Copyright © 2011-2022 走看看