您的位置:首页 > Web前端 > BootStrap

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

2017-02-09 10:03 711 查看

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')   获取选中的行时候 仍然可以获得到默认加载时选中的数据

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: