Advice for treating sorting and filtering independently?

Advice for treating sorting and filtering independently?

davecdavec Posts: 6Questions: 0Answers: 0
edited June 2011 in General
Hi Alan, could I get your thoughts on something? :)

We have some columns where a single cell might have contents something like:

5/20/2011 Review requirements
5/25/2011 Draft proposal
5/30/2011 Send proposal

We want the column to sort by each cell's first date, so we put the first date in a DIV attribute, and use Custom Data Source Sorting (http://datatables.net/development/sorting#data_source) to extract the date attribute when sorting (also, in some cases we'll allow in-place editing of dates, and dynamically update the date attribute).

The issue we've run into is that the filter feature is also looking at the date attribute. Unlike the sort, we'd like the filter to look at the contents of each cell (so that you can search for e.g. "Send proposal").

I think what we'd like to do is treat sorting and filtering independently of each other.

Do you have any suggestions?

Replies

  • allanallan Posts: 65,442Questions: 1Answers: 10,870 Site admin
    One thing you could do is use the iDataSort parameter to sort based on the information in a different (hidden) column - and allow the filtering to work only on your visible column. Or another option would be to use a custom filtering plug-in (type based) - http://datatables.net/development/filtering - which would let you customise what is being used for the filter.

    Regards,
    Allan
This discussion has been closed.