Help Documentation for Datatables Filters

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

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)

I'm using the yajra/laravel-datatables plugin

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.

Deleted comment

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
)

https://yajrabox.com/docs/laravel-datatables/master/html-builder-callbacks

Thanks

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(