w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
tablesorter select multiple options from select dropdown menu and custom time filter?

In that demo, there is a class name "filter-select" in the time column which is overriding the filter_functions. All you need to do is remove that class

<th data-placeholder="Select a time block">Time</th>

then update the filter_functions to use the exact (e) value instead of the normalized value (n) which is actually a very large number (time in seconds since 1/1/2000; as defined by the time parser).

filter_functions: {

    1: {
        "Morning": function (e, n, f, i) {
            return parseInt(e, 10) < 12;
        },
        "Afternoon": function (e, n, f, i) {
            var num = parseInt(e, 10);
            return num >= 12 && num <= 18;
        },
        "Evening": function (e, n, f, i) {
            return parseInt(e, 10) > 18;
        }
    }
}

As for the second part of your question, the filter widget doesn't currently support a multiple-select element. It may in the future; but in the mean time, you might want to check out this demo (still in beta) that uses the select2 plugin external to the table.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.