View | Details | Raw Unified | Return to bug 40118
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-21 / +24 lines)
Lines 1057-1083 function _dt_add_filters(table_node, table_dt, filters_options = {}) { Link Here
1057
                } else if (typeof filters_options[i] === "function") {
1057
                } else if (typeof filters_options[i] === "function") {
1058
                    filters_options[i] = filters_options[i](table_dt);
1058
                    filters_options[i] = filters_options[i](table_dt);
1059
                }
1059
                }
1060
                $(filters_options[i]).each(function () {
1060
                $(filters_options[i])
1061
                    let optionValue =
1061
                    .filter(function () {
1062
                        table_dt.settings()[0].ajax !== null
1062
                        return this._id && this._str;
1063
                            ? `^${this._id}$`
1063
                    })
1064
                            : this._id;
1064
                    .each(function () {
1065
                    let o = $(
1065
                        let optionValue =
1066
                        `<option value="${optionValue}">${this._str}</option>`
1066
                            table_dt.settings()[0].ajax !== null
1067
                    );
1067
                                ? `^${this._id}$`
1068
                                : this._id;
1069
                        let o = $(
1070
                            `<option value="${optionValue}">${this._str}</option>`
1071
                        );
1068
1072
1069
                    // Compare with lc, or selfreg won't match ^SELFREG$ for instance, see bug 32517
1073
                        // Compare with lc, or selfreg won't match ^SELFREG$ for instance, see bug 32517
1070
                    // This is only for category, we might want to apply it only in this case.
1074
                        // This is only for category, we might want to apply it only in this case.
1071
                    existing_search = existing_search.toLowerCase();
1075
                        existing_search = existing_search.toLowerCase();
1072
                    if (
1076
                        if (
1073
                        existing_search === this._id ||
1077
                            existing_search === this._id ||
1074
                        (existing_search &&
1078
                            (existing_search &&
1075
                            this._id.toLowerCase().match(existing_search))
1079
                                this._id.toLowerCase().match(existing_search))
1076
                    ) {
1080
                        ) {
1077
                        o.prop("selected", "selected");
1081
                            o.prop("selected", "selected");
1078
                    }
1082
                        }
1079
                    o.appendTo(select);
1083
                        o.appendTo(select);
1080
                });
1084
                    });
1081
                $(th).html(select);
1085
                $(th).html(select);
1082
            } else {
1086
            } else {
1083
                var title = $(th).text();
1087
                var title = $(th).text();
1084
- 

Return to bug 40118