";
$(".table tr th").each(function(colIndex,obj){
if(colIndex==0) { //第一列th含 checkbox ,结束本次循环, 下标从1开始反之0开始
var ckVal = $(this).find("input[type='checkbox']").val();
if(typeof(ckVal) != "undefined") {
return true;
}
}
var checked = ($(this).is(":visible") ? "checked='checked'":"");
var ckbox_html = "
";
html+="
";
})
html +="
";
$.jBox(html,{title:"Custom Columns",submit:submit});
}
//自定义列初始化,先取cookie 后取table tr th
function customColumnInit() {
var key = getLocationPathName()+"_visCols";
var abVisCols = Cookies.get(key);
if(abVisCols != null && abVisCols.length > 0) {
abVisCols = $.parseJSON(abVisCols);
$(abVisCols).each(function(indexCol,col){
if(col) {
//选中则显示
showColumn(indexCol);
}else {
hideColumn(indexCol);
}
})
}else {
$(".table tr th").each(function(){
var indexCol = $(this).index();
if($(this).attr("isVisible")=="false") {
hideColumn(indexCol);
}else {
//选中则显示
showColumn(indexCol);
}
});
}
}
//隐藏索引列
function hideColumn(index) {
$(".table tr").each(function() {
$(this).find("th:eq(" + index + ")").hide();
$(this).find("td:eq(" + index + ")").hide();
})
}
//显示索引列
function showColumn(index) {
$(".table tr").each(function() {
$(this).find("th:eq(" + index + ")").show();
$(this).find("td:eq(" + index + ")").show();
})
}