How to hide item from colvis collection menu?
How to hide item from colvis collection menu?
I have certain columns that has column title in the datatables grid which has colvis support.
But I don't wanta some of them to be shown in the colvis collection menu, such as some identification id.
For example, I made a column with width zero, and get data from server response.
《table class="table table-bordered table-hover" id="tableListProvider"》
《thead》
《tr》
《th class="text-right" style="width:10%"》serialNo《/th》
《th style="width:20%"》providerName《/th》
《th style="width:0%"》providerId《/th》
《th class="text-center" style="width:70%"》Operation《/th》
《/tr》
《/thead》
《tbody》
《/tbody》
《/table》
$('#tableListProvider').dataTable({
dom: "l<'pull-right'B>frtip",
autoWidth: false,
lengthChange: true,
searching: true,
info: true,
paging: true,
buttons: [
{
extend: 'colvis',
text: " Choose Columns",
className: 'btn-sm'
}
],
columns: [
{
data: null,
className: 'text-right',
render : function(data, type, row, meta) {
return meta.settings._iDisplayStart + meta.row + 1;
}
},
{ data: 'providerName' },
{ data: 'providerId' , visible: false }
],
//...
});
How to I modify the button for 'colvis' to hide column 'providerId' from the colvis dropdown menu?
Thanks very much!