首页 > 设计 > WEB开发 > 正文

BootStrap-table 复选框默认选中(checkbox)

2019-11-02 18:27:39
字体:
来源:转载
供稿:网友

BootStrap-table 复选框默认选中(checkbox)

bootstrap table colums 写法

var columns = [{            field : 'checked',            checkbox : true,            formatter : stateFormatter        }]

用colums  属性设置  显示的格式

/** * 复选按钮默认选中 格式化 *  * @param {} *            value * @param {} *            row * @param {} *            index * @return {} */function stateFormatter(value, row, index) {    if (row.state == true)        return {            disabled : true,//设置是否可用            checked : true//设置选中        };    return value;}

总结

可以看出bootstrap checkbox 返回是这样的一个结果对象{            disabled : true,//设置是否可用            checked : true//设置选中        };

但是  在通过bootstrap  $('#Table') .bootstrapTable('getAllSelections')   获取选中的行时候 仍然可以获得到默认加载时选中的数据


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表