Filtering not working as desired

Filtering not working as desired

saudagarrizwansaudagarrizwan Posts: 8Questions: 1Answers: 0
edited January 2014 in DataTables 1.9
Hi,

Am using datatables in my application. Paging and sorting is done using this. I have a search filter. How it should work is, if a user searches “Math Benchmark 1”, then the result display matching the complete name first, then “Math Benchmark”, then “Math”, and finally any words from the assessment. The default sort order is the one most matching the criteria first. How could I do this using datatable? I tried using $.fn.dataTableExt.afnFiltering, but am not getting proper result.

I appreciate your help in this

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    To be honest, I'm not sure how you would do this either! I think it is possible, but for the order to be defined by the filter you would need to use custom ordering through the `$.fn.dataTableExt.afnSortData` option - which would of course need to be aware of the filtering value:
    http://datatables.net/development/sorting#data_source

    I've not come across this type of search priority result requirement before, so would be interested to know how you get on. Normally filtering and sorting in DataTables are orthogonal.

    Allan
This discussion has been closed.