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

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-3 / +29 lines)
Lines 1014-1020 function _dt_save_restore_state(table_settings, external_filter_nodes={}){ Link Here
1014
        // but only the main one has the table settings (and so the state saved)
1014
        // but only the main one has the table settings (and so the state saved)
1015
        data.external_filters = Object.keys(external_filter_nodes).reduce(
1015
        data.external_filters = Object.keys(external_filter_nodes).reduce(
1016
            (r, k) => {
1016
            (r, k) => {
1017
                r[k] = $(external_filter_nodes[k]).val();
1017
                let node = $(external_filter_nodes[k]);
1018
                let tag_name = node.prop("tagName");
1019
                if (tag_name == "INPUT" && node.prop("type") == "checkbox") {
1020
                    r[k] = $(external_filter_nodes[k]).prop("checked");
1021
                } else if (tag_name == "INPUT" || tag_name == "SELECT") {
1022
                    r[k] = $(external_filter_nodes[k]).val();
1023
                } else {
1024
                    console.log(
1025
                        "Tag '%s' not supported yet for DT state".format(
1026
                            tag_name
1027
                        )
1028
                    );
1029
                }
1018
                return r;
1030
                return r;
1019
            },
1031
            },
1020
            {}
1032
            {}
Lines 1026-1032 function _dt_save_restore_state(table_settings, external_filter_nodes={}){ Link Here
1026
        if (data.external_filters) {
1038
        if (data.external_filters) {
1027
            Object.keys(external_filter_nodes).forEach((k, i) => {
1039
            Object.keys(external_filter_nodes).forEach((k, i) => {
1028
                if (data.external_filters.hasOwnProperty(k)) {
1040
                if (data.external_filters.hasOwnProperty(k)) {
1029
                    $(external_filter_nodes[k]).val(data.external_filters[k]);
1041
                    let node = $(external_filter_nodes[k]);
1042
                    let tag_name = node.prop("tagName");
1043
                    if (
1044
                        tag_name == "INPUT" &&
1045
                        node.prop("type") == "checkbox"
1046
                    ) {
1047
                        node.prop("checked", data.external_filters[k]);
1048
                    } else if (tag_name == "INPUT" || tag_name == "SELECT") {
1049
                        node.val(data.external_filters[k]);
1050
                    } else {
1051
                        console.log(
1052
                            "Tag '%s' not supported yet for DT state".format(
1053
                                tag_name
1054
                            )
1055
                        );
1056
                    }
1030
                }
1057
                }
1031
            });
1058
            });
1032
        }
1059
        }
1033
- 

Return to bug 33484