Jess McKenzie Jess McKenzie - 9 months ago 68
Ajax Question

Sorting Tabulated Data

For example if I have a table with some data in it.

  • What would be the best way to be able to sort this information via a date picker?

  • How could I make this table accept information from an Ajax or JSON feed if required?

I have been given the following question hence my query regarding the question above:

In HTML display a set of tabular data where the data contains dates. Implement a date picker that filters the tabular data. Where possible allow for the tabular data to be supplied via ajax or json feeds.

Answer Source

Like @Tats_innit said in the comment you can use tabsorter plugin to accomplish this. Using this plugin is easy, after loading the js files just use this

    // include zeba widgets
    widgets: ['zebra'],
    sortList: [[0, 0], [2, 0]]

Working fiddle

It detect date columns automatically and sort according to date orders.

You can check how can you append ajax fetched data into it here