首页 > 技术文章 > bootstrap-table 回显选中行,行样式

asker009 2018-09-10 10:28 原文

{
    filed:'status',
    checkbox:true,
    formatter:function(value,row,index){
        if (row.status == 1)  //根据行里字段判断是否选中
            return {
                checked : true//设置选中
            };
        return value;
    }

}

 

行样式:

  rowStyle: function (row, index) {
                //这里有5个取值代表5中颜色['active', 'success', 'info', 'warning', 'danger'];
                var strclass = "";
                if (row.name == "删除环境") {
                    strclass = 'danger';//还有一个active
                }
                else if (row.name == "新增环境") {
                    strclass = 'success';
                }
                else {
                    return {};
                }
                return { classes: strclass }
            },

 

推荐阅读