您可以使用这样的类名排除:
"aoColumnDefs": [{ "mColumns": false, "aTargets": ["no-export"] }],
这是我在生产中工作的类似代码:
var oTable = $('#<%= gvComputers.ClientID %>').dataTable({
"bJQueryUI": true,
"bStateSave": true,
"sPaginationType": "full_numbers",
"aLengthMenu": [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, "All"]],
"aoColumnDefs": [
{ "sSortDataType": "dom-text", "aTargets": ["text-sort_fixed"] },
{ "sType": "numeric", "aTargets": ["numeric-sort"] },
{ "sSortDataType": "dom-select", "aTargets": ["select-sort"] },
{ "sSortDataType": "dom-checkbox", "aTargets": ["checkbox-sort"] },
{ "bSearchable": false, "aTargets": ["no-search"] },
{ "bSortable": false, "aTargets": ["no-sort"] }
]
});
我根据需要在表头、页脚和单元格上动态设置类,因为我不知道用户将从他们的个人数据视图中删除哪些列。
hth