Pre defined date range filtering

Pre defined date range filtering

ashleycashleyc Posts: 4Questions: 2Answers: 0

Hi,

I was just wondering if there was an easy way in datatables to set up date filtering based on todays date/ tomorrow/ last six months, etc etc. I've looked through the documentation plus plugins page and couldn't really see anything appropriate. I can't link to the site as it's an admin area, however we already have implemented the ability to filter based on dates entered.

So to summarise, I need the ability to select for example a drop down "Today" which would filter our data based on todays date. I'm not being lazy and expecting someone to write something for me, just hoping that there is already a solution out there amongst everything else that Datatables has to offer!

Thanks

Ashley

This question has an accepted answers - jump to answer

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited October 2014 Answer ✓

    Well, sounds that you can go ahead and be a bit lazy.... because I wrote something that can be handy... my yadcf plugin for datatables got a custom function filter type, that function is executed by a select drop box which can be predefined with values... yada yada yada... look at the showcase http://yadcf-showcase.appspot.com/DOM_source.html , inspect the first column and see how it works... then scroll down and see the code. IMO it can do exactly what you want. in addition yadcf got 8 other filter types...

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39

    This isn't the requested solution, but just something to consider. Read on if you'd like.

    I'm not sure how much data you have, how you are loading it, or how much time you want to put into it; but I think it is really nice handling date filtering on the server side. That way you use a date range picker, and can put little buttons above it with today, yesterday, past week, month, whatever you want. Then you handle the dates displayed with the database query.

    If you only have one table it might not be time efficient. But if you have a lot of different tables I think it is definitely worth doing.

  • ashleycashleyc Posts: 4Questions: 2Answers: 0

    Thanks for the responses! ignignokt , I did think of doing it that way, however the person I work for specifically wanted dropdown selections.

This discussion has been closed.