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

(-)a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.keepConditions.js (-6 / +24 lines)
Lines 852-879 var KeepConditions = (function () { Link Here
852
852
853
                    // Check if condition is setup on table
853
                    // Check if condition is setup on table
854
                    isInit: function isInit() {
854
                    isInit: function isInit() {
855
                        return typeof _parent._dtSettings.oInit.searching === 'undefined' || _parent._dtSettings.oInit.searching !== false;
855
                        return true; // FIXME
856
                        //return typeof _parent._dtSettings.oInit.searching === 'undefined' || _parent._dtSettings.oInit.searching !== false;
856
                    },
857
                    },
857
858
858
                    // Function to check if a condition exists in the hash, and to process it
859
                    // Function to check if a condition exists in the hash, and to process it
859
                    onLoad: function onLoad(hashComponent) {
860
                    onLoad: function onLoad(hashComponent) {
860
                        if (typeof hashComponent !== 'undefined' && _parent._dtApi.search() !== decodeURIComponent(hashComponent)) {
861
                        if (typeof hashComponent !== 'undefined' ) {
861
                            _parent._dtApi.search(decodeURIComponent(hashComponent));
862
                            var filters = JSON.parse(decodeURIComponent(hashComponent));
863
                            var global_filter = filters['f'];
864
                            var column_filters = filters['cf'];
865
                            var table_dt = $(_parent._dtApi.table);
866
                             _parent._dtApi.search(global_filter);
867
                            $.each(column_filters, function(i, v){
868
                                if ( v != "" ) {
869
                                    $(table_dt).find('thead tr:eq(1) th:eq('+i+') input').val(v);
870
                                    //_parent._dtApi.column(i).search(v).draw();
871
                                    _parent._dtApi.column(i).search(v);
872
                                }
873
                            });
874
862
                            _parent._shouldDraw = true;
875
                            _parent._shouldDraw = true;
863
                        }
876
                        }
864
                    },
877
                    },
865
878
866
                    // Check if a value for this condition is currently set for the table (and not at default)
879
                    // Check if a value for this condition is currently set for the table (and not at default)
867
                    isset: function isset() {
880
                    isset: function isset() {
868
                        return _parent._dtApi.search().length !== 0;
881
                        return true; // FIXME
882
                        //return _parent._dtApi.search().length !== 0;
869
                    },
883
                    },
870
884
871
                    // Return the new value to be stored in the hash for this conditions component
885
                    // Return the new value to be stored in the hash for this conditions component
872
                    newHashVal: function newHashVal() {
886
                    newHashVal: function newHashVal() {
873
                        return encodeURIComponent(_parent._dtApi.search());
887
                        var global_filter = _parent._dtApi.search();
888
                        var column_filters = [];
889
                        _parent._dtApi.columns().search().each(function(v,i){
890
                            column_filters.push(this[i]);
891
                        });
892
                        return encodeURIComponent(JSON.stringify({'f': global_filter, 'cf': column_filters }));
874
                    }
893
                    }
875
                },
894
                },
876
877
                /**
895
                /**
878
                 * Condition: Length
896
                 * Condition: Length
879
                 *
897
                 *
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc (+1 lines)
Lines 2-5 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% INCLUDE 'format_price.inc' %]
3
[% INCLUDE 'format_price.inc' %]
4
[% Asset.js("lib/datatables/datatables.min.js") | $raw %]
4
[% Asset.js("lib/datatables/datatables.min.js") | $raw %]
5
[% Asset.js("lib/jquery/plugins/dataTables.keepConditions.js") | $raw %]
5
[% Asset.js("js/datatables.js") | $raw %]
6
[% Asset.js("js/datatables.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt (+1 lines)
Lines 188-193 Link Here
188
                "ajax": {
188
                "ajax": {
189
                    "url": cities_table_url
189
                    "url": cities_table_url
190
                },
190
                },
191
                keepConditions: true,
191
                "order": [[ 1, "asc" ]],
192
                "order": [[ 1, "asc" ]],
192
                "columnDefs": [ {
193
                "columnDefs": [ {
193
                    "targets": [0,1,2,3,4],
194
                    "targets": [0,1,2,3,4],
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-1 / +21 lines)
Lines 734-739 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
734
                buttons: export_buttons
734
                buttons: export_buttons
735
            }
735
            }
736
        );
736
        );
737
        settings["buttons"].push(
738
            {
739
                extend: 'copyConditions',
740
                autoClose: true,
741
                fade: 100,
742
                className: "copyConditions_controls",
743
                titleAttr: __("Copy conditions"),
744
                text: '<i class="fa fa-lg fa-copy"></i> <span class="dt-button-text">' + __("Copy conditions") + '</span>',
745
            }
746
        );
747
748
        settings["buttons"].push(
749
            {
750
                extend: 'copyConditions',
751
                autoClose: true,
752
                fade: 100,
753
                className: "copyConditions_controls",
754
                titleAttr: __("Copy conditions"),
755
                text: '<i class="fa fa-lg fa-copy"></i> <span class="dt-button-text">' + __("Copy conditions") + '</span>',
756
            }
757
        );
737
758
738
        $(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip();
759
        $(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip();
739
760
740
- 

Return to bug 27467