How to filter table data to only show future events

How to filter table data to only show future events

keithrkeithr Posts: 2Questions: 1Answers: 0

Hi Everyone!
I have a table of data (big surprise, I know) - Date, Title, Event Details.
The data is stored in a JSON file, and I can display it fine in DataTables.

My ask - What's the best, easiest way to only show events happening in the future - i.e. where Date is great than [today]?

I've been looking at the filter and search parts of the manual, and I can't see a quick/easy way of achieving what I want.
A friend has provided a whole bunch of code that absolutely does the job, but I was wondering if there's a simple way using the power of DataTables.

Many thanks in advance,

Keith. :)

Answers

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923

    This Range Search example will show you how. Using moment.js for the comparison might make it easier.

    Kevin

  • keithrkeithr Posts: 2Questions: 1Answers: 0

    Thank you, Kevin - I can see this is going in the right direction, but I'm sufficient of a beginner in JavaScript as to be hoping for some sample code that I can learn from. I need a little more help, please, if you have the time.

    Take care,

    Keith.

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923

    There are quite a few threads discussing how to do this like this thread.

    Kevin

This discussion has been closed.