On this page, we have some filters to apply to the datatables, but there is no documentation on how to use them or how to make them look like the example. https://preview.keenthemes.com/metronic8/demo1/apps/subscriptions/list.html
I found the only documentation at: https://preview.keenthemes.com/metronic8/demo1/documentation/general/datatables/server-side.html
But it doesn't explain how to add fields in the filter, I need to add SELECT, INPUT text, INPUT start date and end date fields.
But there's no documentation
Hi Rafael Antonio,
If you have some simple js that need to initialise in the datatable, you can put it in this config (initComplete). This is an example.
->initComplete(<<<JS
function(settings, json) {
var filter = $("#productTypeFilter");
// set the dropdown from the state
if(typeof LaravelDataTables["products-table"].state() !== "undefined" && typeof LaravelDataTables["products-table"].state().columns[3].search.search !== "undefined") {
filter.val(LaravelDataTables["products-table"].state().columns[3].search.search)
}
$(this).closest(".dataTables_wrapper").find(".dataTables_filter").prepend(filter.closest("label").removeClass("d-none"));
}
JS
)
Hi Rafael Antonio,
There is documentation in the official plugin site.
https://yajrabox.com/docs/laravel-datatables/master/filter-column
You can put the filter function under app/DataTables in dataTable() function.
Thanks
Yes, you are just presenting the PHP part and not Javascript, the biggest problem is JavaScript, to leave the same example as we have in the layout.
I'm using the yajra/laravel-datatables plugin