koalyptus / TableFilter

A Javascript library making HTML tables filterable and a bit more :)
https://www.tablefilter.com
MIT License
324 stars 95 forks source link

custom_options.sorts = [false] has no effect #703

Closed ebw44 closed 5 years ago

ebw44 commented 5 years ago

In the example https://www.tablefilter.com/custom-filter-options.html the custom_option sorts = [false] seems to have no effect.

koalyptus commented 5 years ago

Hi @ebw44 , in above example open the browser console and type following js instructions:

tf.customOptions.sorts = [true];
tf.destroy();
tf.init();

Inspect the POP column filter and note the options sorted in alphanumeric manner and not in order of appearance, it seems to have an effect :).

Cheers

ebw44 commented 5 years ago

Thanks @koalyptus, I misunderstood the "customOptions.sorts". I though I could use it to disable sorting for a specific column when it concern only the drop-down (as clearly stated in the documentation Is there anyway to disable sorting for a specific column? One of my column is a checkbox, and the interaction between sorting and checking is not great.

Thanks

jmcarson commented 5 years ago

I had this same question. It looks like setting the sort: types (or col_types) for the column to 'none' will disable sorting for that specific column. For example either of the following disables sorting for the first column. extensions:[ { name: 'sort', types: ['none', 'string'] }, ], or: col_types: ['none','string']

I found the none type here. https://github.com/koalyptus/TableFilter/wiki/3.1-Sort