Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


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
)




Thanks



Hi Rafael Antonio,

There is documentation in the official plugin site.


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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(