would like to download excel file between a date range from & to ( start & end date need to be collected from the user and based on that it should allow to download a excel sheet. I did search forum and could not find a working example. thanks for wonderful application.
date range filter
- Single Page
Posted 02 December 2015 - 12:37 PM
Posted 23 November 2017 - 10:36 AM
Hi,
I have a date column.And would like to filter date and then use the export option available in grocery crud. As the table size is huge and I just need one month data to be exported. How to do this
Posted 23 November 2017 - 16:45 PM
Well, you can have the date range filter set before the crud view (where you echo $output) .. in that view, you can let user select the date range and submit it back to the action.
Now - what you can do is - set the date range filter with $crud->where clause. That way you can restrict your data.
Happy GCing :)
Posted 24 November 2017 - 10:56 AM
Thanks, Since I am not a hard coding guy, bit of example codes will help me learn things.
Posted 24 November 2017 - 11:38 AM
Well, you can refer to the following link to set up the date params.
https://jqueryui.com/datepicker/
As for showing up the same in view, i might not be able to build u a code for that but i can guide you. You can build up a form whose action points to the URL of the method where you want to apply the filter to.
Everytime user hits that method, do check if the user have submitted those values by any chance? If so, set the from_date / to_date (captured from the form) into the session. If they have not been set by user, do check if the same have been there in session. If so, fetch back the dates.
If the dates are set by user, then you can filter the same in following manner.
$crud->where('field_date >= $fromDate'); $crud->where('field_date <= $toDate');
Happy GCing :)