BootStrap-table 复选框 问题
来源:互联网 发布:淘宝泰州医药城地址 编辑:程序博客网 时间:2024/05/16 04:51
添加以下中的红色代码可实现,部分复选框默认勾选。
$(function() {
$('.bs-example').each(function() {
var source = $('<div></div>').text($(this).html()).html(),
sources = source.split('\n'),
codes = [],
spaces = 0;
$.each(sources, function(i, text) {
if (!$.trim(text)) {
return;
}
if (!spaces) {
spaces = text.match(/(^\s+)/)[1].length;
}
codes.push(text.substring(spaces));
});
$(this).next().find('code').html(codes.join('\n'));
});
var $table = $("#table");
selections = [];
initTable();
$("#select").click(function(){
var ids = getIdSelections();
alert(ids);
})
function getIdSelections() {
return $.map($table.bootstrapTable('getSelections'), function (row) {
return row.name;
});
}
function initTable(){
$table.bootstrapTable({
columns:[ {
field: 'state',
checkbox: true,
formatter:stateFormatter
},{
field: 'id',
title: 'Item ID',
sortable: true,
editable: true,
align: 'center',
formatter:function(value, row, index){
return value;
}
}, {
field: 'name',
title: 'Item Name',
sortable: true,
editable: true,
align: 'center'
}, {
field: 'price',
title: 'Item Price',
sortable: true,
editable: true,
align: 'center'
}]
})
}
/* $table.find('input[name="btSelectItem"]').each(function(){
var value = $(this).attr('data-index');
alert(value);
})*/
function stateFormatter(value, row, index) {
if (row.id === 2) {
return {
disabled: true,
checked: true
};
}
if (row.id === 0) {
return {
disabled: true,
checked: true
}
}
return value;
}
});
1 0
- BootStrap-table 复选框 问题
- BootStrap-table 复选框默认选中(checkbox)
- BootStrap-table 复选框默认选中(checkbox)
- bootstrap-table自定义复选框列的样式
- bootstrap-table分页问题
- bootstrap-table编号问题
- bootstrap-table 复选框的操作,如提前选中,是否可选等
- bootstrap-table中的checkbox(复选框)被选中时触发的函数
- Bootstrap复选框、EasyUI datagrid复选框
- bootstrap-table 分页的问题
- bootstrap中的table相关问题
- bootstrap-table 分页的问题
- bootstrap-table遇到的问题
- table复选框全选功能
- bootstrap-table复选框默认选中。(从数据库获取到对应的状态进行判断是否为选中状态)
- Bootstrap之表格checkbox复选框全选
- Bootstrap实现表格复选框全选
- Bootstrap之表格checkbox复选框全选
- 表单
- 跟我一起学习mysql技术内幕(第五版)吧!(学习日志)
- 如何每日增量加载数据到Hive分区表
- leetcode014 Longest Common Prefix
- Android中常见IPC方法总结
- BootStrap-table 复选框 问题
- Netty系列之Netty百万级推送服务设计要点
- 公共技术点之面向对象六大原则
- 2016高端对话:CMMI的企业价值
- Fragment的startActivityForResult详细解决方案
- python之类-django进阶
- [LinkedList和数组]——自定义Map升级版
- 项目之IC卡芯片3
- 解决switch……case不能匹配字符串的方法