我的桌子是
<table id="EmployeesTable" style="width: 100%;" class="grid-table06 border-one">
<thead>
<tr>
<th width="80%" align="left" valign="middle">Name</th>
<th width="20%" align="left" valign="middle">Department</th>
<th>Id</th>
</tr>
</thead>
</table>
我的脚本如下
$(function () {
$(".switchDate").click(function () {
var id = $(this).attr("rel");
fetchEmployeedetails(id);
});
fetchEmployeedetails(@model.Id); //on load
function fetchEmployeedetails(id) {
$("#EmployeesTable").dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Employees/FetchDetails?Deptid=" + id + "&thresholdLow=4&threshold=100",
"sPaginationType": "full_numbers",
"bDestroy": true,
"aaSorting": [[1, 'desc']],
"asStripClasses": ['color01', 'color03'],
"aoColumnDefs": [{
"aTargets": [2],
"bVisible": false
}, {
"aTargets": [1],
"fnRender": function (oObj) {
return "<a href='#showemployees' rel='" + oObj.aData[2] + "'></a>";
}
}]
});
}
});
加载时它工作正常,不显示隐藏的“Id”列,但如果我通过点击功能上的 switchDate 选择 id,它会导致隐藏列第二次可见。
如何永久隐藏该列?