First question here on SO and not very familiar with datatables, so please bear with me if I'm leaving out info!
So I am using Metronic's/KeenThemes's plugin to show a datatable and I want to use Datatables's column visibility implementation to show/hide certain columns and save the column visibility state, as demonstrated here: https://datatables.net/extensions/buttons/examples/column_visibility/simple.html
I am particularly interested in this part then:
Datatables's example code
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'colvis'
]
} );
} );
So KeenTheme's documentation just has an 'API methods' section in their documentation page but no explanation of how/where to implement it. I am confused as to where to apply the above piece of code and how to implement other datatable methods.
index.js
var datatable = $('#kt_datatable').KTDatatable({
// datasource definition
data: {
type: 'remote',
source: {
read: {
method: 'GET',
url: //getUrl
// return data etc etc
}
}
},
layout: {
//layout
},
// more stuff
columns: [
{
field: 'id',
title: '',
sortable: false,
visible: true,
width: 20,
type: 'number',
selector: { class: 'kt-checkbox--solid' },
textAlign: 'center',
},
// more columns
],
})
index.volt (html):
<div id="kt_datatable"></div>
Any ideas how to implement this .DataTable code in this KT Datatable? Thanks for your help!