column visibility does not work for me now (worked few months ago)
column visibility does not work for me now (worked few months ago)
Hokwang
Posts: 8Questions: 4Answers: 0
Hello.
I am using php and datatables 1.10.19 with
jquery 3.3.1
semantic ui 2.3.1
datatables buttons 1.5.1 .
I guess some bug occured in here because few months ago (when I used previous version but I don't know what it is exactly) it works normally.
My javascript is below. Now excel export works well but colvis does not work.
$('.ui.form').form({
<snip>
}).api({
method: 'POST',
<snip>
onSuccess: function(response) {
if ( $('#result_div').length > 0 ) {
$('#result_div').remove();
}
$('.ui.basic.segment').append('<div class="ui segment" id="result_div">\
<table class="ui celled striped compact table" id="result_table">\
<thead>\
<tr>\
<snip>
</tr>\
</thead>\
</table>\
</div>');
var table = $('#result_table').DataTable({
lengthChange: false,
destroy: true,
deferRender: true,
scrollX: true,
data: response.data,
columns: [
<snip>
],
buttons: [
{
extend: 'excelHtml5',
exportOptions: {
columns: ':visible'
}
},
{
extend: 'colvis',
columns: ':not(.noVis)'
}
],
columnDefs: [
{
targets: 0,
className: 'noVis'
},
{
targets: 7,
visible: false
}
]
});
table.buttons().container().appendTo( $('div.eight.column:eq(0)', table.table().container()) );
},
onFailure: function(response) {
console.log('error');
}
});
screen capture is below. When I move over the menu mouse pointer is still default it does not change to hand for select. I guess here's some problem...
This discussion has been closed.
Answers
Hi @Hokwang ,
This is the example on the DataTables site, and this appears to work as expected to me. Would you be able to create a test case or link to a page that demonstrates the problem, please,
Cheers,
Colin