Hello KoolTeam :)
I found cool functionality in DataTables which saves colvis state ( https://datatables.net/extensions/buttons/examples/column_visibility/stateSave.html ) but its not working for me and i try to understand where is the issue but i stuck.
DataTables::create(array(
"fastRender" => true,
"dataSource"=>$this->dataStore("test"),
"plugins" => ["Buttons"],
"showFooter"=>true,
"options" => array(
"paging"=>true,
"searching" => true,
"dom" => 'Bfrtip',
"stateSave"=>"true",
"buttons" => [
[
"extend" => 'pdfHtml5',
"messageTop" => $messageTop,
"title" => $companyName,
"exportOptions" => array(
"columns"=> ":visible",
),
"customize"=>"function(doc) {
doc.pageMargins = [10, 10, 10,10 ];
}",
],
[
"extend" => 'excelHtml5',
"exportOptions" => ["columns"=> ":visible"],
"filename" => $fileName,
"title" => $companyName,
"sheetName" => $sheetName,
"messageTop" => $messageTop
],
[
"extend" => 'print',
"exportOptions" => ["columns"=> ":visible"],
"text" => "print"
],
[
"extend" => 'csv',
"exportOptions" =>["columns"=> ":visible"],
"text" => "CSV"
],
[
"extend" => 'colvis',
"text" => "colvis"
],
],
),
"columns" => array(
"a" => array(
"type"=>"string",
"label"=>"a",
),
"b" => array(
"type"=>"string",
"label"=>"b",
),
"c" => array(
"type"=>"string",
"label"=>"c",
),
"d" => array(
"type"=>"string",
"label"=>"d",
"formatValue"=>function($value){
return ($value)=="1"? "1":"0";
}
),
"e" => array(
"type"=>"string",
"label"=>"e",
),
"f" => array(
"type"=>"string",
"label"=>"f",
"formatValue"=>function($value){
return '<a target="_blank" href=" ' . WP_CONTENT_URL . '/test/'. $value .'">'. $value .'</a>';
}
),
"g"=> array(
"type"=>"number",
"decimals"=>2,
"decimalPoint"=>".",
"thousandSeparator"=>",",
"label"=>"g",
"footer"=>"sum",
"footerText" => "sum : <br> @value",
),
"h" => array(
"type"=>"string",
"label"=>"h",
),
),
"cssClass"=>array(
"table"=>"table table-striped table-bordered"
),
));
Greetings