.table_list_box{
table-layout:fixed !important;
}
table-layout:fixed就能解决表格不对齐的问题,
//解决当浏览器窗口变化是,表头与表格不对齐
$(window).resize(function () {
$('#table').bootstrapTable('resetView');
});
$('#table').bootstrapTable('destroy').bootstrapTable({
//是否启用排序
sortable: true,
height:330,
fixedColumns: true,
columns: [
[{
field: 'name',
title: "名称",
valign:"middle",
align:"center",
colspan: 1,
rowspan: 2,
width:"20%",
sortable : true
},
{
title: tableheader,
valign:"middle",
align:"center",
width:"60%",
colspan: 3,
rowspan: 1
},
{
title: "操作",
valign:"middle",
align:"center",
colspan: 1,
rowspan: 2,
width:"20%",
formatter:formatterButton
}],
[{
field: 'yesterday',
title: '昨日',
valign:"middle",
align:"center",
width:"20%",
sortable : true
},
{
field: 'month',
title: '月',
valign:"middle",
align:"center",
width:"20%",
sortable : true
},
{
field: 'year',
title: '年',
valign:"middle",
align:"center",
width:"20%",
sortable : true
},
{
field: 'id',
title: 'id',
valign:"middle",
align:"center",
width:"0%",
visible:false
}
]
]
});
}
function formatterButton(value, row ,index){
if(row.isHaveChild){
return ""+
"
}else{
return ""+
"
}
}