Filter Datatable using date picker
Filter Datatable using date picker
Akku
Posts: 1Questions: 1Answers: 0
I want to filter the data table based on the date range selected from date picker. For e.g I want to display all the data of a particular month. I don't have a start and end date column in my table. Just a due date column is there which need not to be tied to date filter. Is it possible?
This discussion has been closed.
Answers
Hi Akku,
I think you can.
This is how I did it for a similar case. In my case I have a logs table and I want to select the log of a specific day.
I have a date picker, when the datepicker changes the onChange event is intercepted and the following code is executed:
Essentially when the datepicker changes, the corresponding data table is reloaded.
In order to instruct the dataTable to take the selected date the dataTable ajax property lis set as follows:
This piece of code adds to the POST call to dtLogs.php the date that is contained into the datepicker (or the current client date if there is no date selected).
The dtLogs.php code contains the following:
dtLogs.php collects the date that is sent via POST and calculates this date + 1 day.
Finally the dtLogs.php uses the following where clause to make sure it selects the right logs (it selects all the logs between the selected date + 1 day).
Hope this helps,
f
Can i have your files pls ineed for my project