• 技术文章 >web前端 >Bootstrap教程

    bootstrap table给行怎么加背景色

    藏色散人藏色散人2019-07-23 11:15:15原创2242

    bootstrap table给行怎么加背景色

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

    相关推荐:《bootstrap教程

    以上就是bootstrap table给行怎么加背景色的详细内容,更多请关注php中文网其它相关文章!

    声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
    专题推荐:bootstrap
    上一篇:bootstrap属于js框架吗 下一篇:bootstrap是框架吗
    大前端线上培训班

    相关文章推荐

    • bootstrap可以用来干什么• bootstrap是哪家开发的• bootstrap是ui框架吗• bootstrap属于js框架吗

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网