i have searchbuilder, in addition i want to add a custom filter button
i have searchbuilder, in addition i want to add a custom filter button
umaeswara
Posts: 85Questions: 17Answers: 0
https://live.datatables.net/dimipoma/1/edit my testcase.
i have already a working searchbuilder. I want to add one more custom filter button name "current year", which when I click on this button filters and shows all rows with Dates with 2025 as their year.
how can I achive this.
thank you.
Answers
This page has details on how to create a custom button. Use the
column().search()
method to set a search for the column in question. Given the format, you could just pass the string for the current year (which you can get from thenew Date()
object).Allan
hi Allan, thanks for reply. i have edited my example with buttons []. but it didnt show any button. please check and help me.
https://live.datatables.net/dimipoma/1/edit
thanks,
Uma-
First you need to add the buttons library to the CDN includes you have. Open the
.js
CDN link and use the upgrade URL provided to add the buttons, for example:For a custom button all you need to add is the
Buttons
option.Next update the
layout
option to display the buttons where you want. See the Buttons initialization docs and this example for more details.Updated test case:
https://live.datatables.net/dimipoma/2/edit
Kevin