sort_select: true does only order by String #284

Open
schmelzpunkt opened this Issue Aug 26, 2016 · 1 comment

Projects

None yet

2 participants

@schmelzpunkt

The sorting of the values in a Dropdown list filter should consider the data type. Right now it seems to sort always by string even if it is a number or a date

@koalyptus
Owner

What you can do at the moment to sort numeric drop-down options in a ascending or descending manner is use the sort_num_asc or sort_num_desc options:

var tfConfig = {
  col_0: 'select',
  col_1: 'checklist',
  sort_num_asc: [0],
  sort_num_desc: [1]
};

The above configuration instructs TableFilter to sort the the drop-down filter numeric options in a ascending manner for the first column and in a descending manner for the second one.

Date sorting for drop-down options is currently not supported, this is another story as the script needs first to support any formatted datetime (refer to #283). However, we could add a callback for sorting the drop-down options, where you would implement your own custom sorter as it is already the case for column sorting (#283).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment