columns : [
{ // 列配置项
field : 'id',
checkbox : true ,
formatter: function (i,row) {
if(row.status!='04'){
return {
disabled : true
}
}
}
},
{
field : 'status',
title : '状态'
} ]
$('#exampleTable')
.bootstrapTable(
{
method : 'get', // 服务器数据的请求方式 get or post
url : prefix + "/listPartner", // 服务器数据的加载地址
// showRefresh : true,
// showToggle : true,
// showColumns : true,
iconSize : 'outline',
toolbar : '#exampleToolbar',
sortable: true, //是否启用排序
sortOrder: "desc", //排序方式
striped : true, // 设置为true会有隔行变色效果
dataType : "json", // 服务器返回的数据类型
pagination : true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect : false, // 设置为true将禁止多选
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize : 10, // 如果设置了分页,每页数据条数
pageNumber : 1, // 如果设置了分布,首页页码
//search : true, // 是否显示搜索框
showColumns : false, // 是否显示内容下拉框(选择显示的列)
sidePagination : "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
queryParams : function(params) {
return {
//说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset:params.offset,
sort:params.sort,
order:params.order
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns : [
{
field : 'id',
title : 'ID'
},
{
field : 'hot',
title : '人气值',
sortable:true
} ]
});
引入bootstrap-table.min.css
添加样式:先查找sortable 样式位置,再按需求添加,注意图片路径
.fixed-table-container thead th .sortable {
background: url('../images/sort.png') no-repeat center right;
cursor: pointer;
padding-right: 25px
}
.fixed-table-container thead th .asc {
background: url('../images/sort_asc.png') no-repeat center right;
cursor: pointer;
padding-right: 30px;
}
.fixed-table-container thead th .desc {
background: url('../images/sort_desc.png') no-repeat center right;
cursor: pointer;
padding-right: 30px;
}
Insert title here
如果不加document.close = close;这一行,点击按钮则不会起作用;因为我们在全局作用域中定义的函数默认会成为window对象的函数,而window对象自身已经定义了close方法,如果再定义则会覆盖掉window对象的close函数。而document对象下也有一个close函数,所以还要覆盖掉document对象下的close函数才能有效,但是最关键的是请尽量使用别的方法名,少使用系统关键字。
原文链接:https://www.cnblogs.com/domost/p/10169677.html
5.jquery 关于radio:checked属性的添加与移除
$(":radio").removeAttr(‘checked’);
$(":radio").attr(‘checked’,‘true’);
实际问题:在使用removeAttr()移除了radio的checked属性后,使用attr()重新增加不起作用;
解决:
$(":radio").removeAttr(‘checked’);
$(“input:radio”).prop(‘checked’,‘true’);
即使用prop()可重新配置上该属性;
注意:具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr().
原文链接:https://blog.csdn.net/qq_34973481/article/details/79424113