From d282436421a776a1578fae5909e24404c80ddabe Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jan 2021 16:33:43 +0100 Subject: [PATCH] Bug 27403: Add fixedHeader to Datatables That's a great plugin to have fixed header. Test plan: On the cities table or the patron search table confirm that the header is floating is you scroll down Signed-off-by: Lucas Gass --- .../lib/datatables/dataTables.fixedHeader.min.js | 32 ++++++++++++++++++++++ koha-tmpl/intranet-tmpl/prog/js/datatables.js | 1 + 2 files changed, 33 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/lib/datatables/dataTables.fixedHeader.min.js diff --git a/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.fixedHeader.min.js b/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.fixedHeader.min.js new file mode 100644 index 0000000000..978f956190 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.fixedHeader.min.js @@ -0,0 +1,32 @@ +/*! + Copyright 2009-2020 SpryMedia Ltd. + + This source file is free software, available under the following license: + MIT license - http://datatables.net/license/mit + + This source file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + + For details please refer to: http://www.datatables.net + FixedHeader 3.1.7 + ©2009-2020 SpryMedia Ltd - datatables.net/license +*/ +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,d,f){c instanceof String&&(c=String(c));for(var h=c.length,g=0;g=e.tfootBottom+this.c.footerOffset?"in-place":e.windowHeight+b>e.tbodyTop+e.tfootHeight+this.c.footerOffset?"in":"above":"in-place",(a||b!==this.s.footerMode)&&this._modeChange(b,"footer",a),this._horizontal("footer",d))}});l.version="3.1.7";l.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0};c.fn.dataTable.FixedHeader=l;c.fn.DataTable.FixedHeader= +l;c(f).on("init.dt.dtfh",function(a,b,d){"dt"===a.namespace&&(a=b.oInit.fixedHeader,d=g.defaults.fixedHeader,!a&&!d||b._fixedHeader||(d=c.extend({},d,a),!1!==a&&new l(b,d)))});g.Api.register("fixedHeader()",function(){});g.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.update()})});g.Api.register("fixedHeader.enable()",function(a){return this.iterator("table",function(b){b=b._fixedHeader;a=a!==h?a:!0;b&&a!==b.enabled()&&b.enable(a)})}); +g.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var a=this.content[0]._fixedHeader;if(a)return a.enabled()}return!1});g.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.enabled()&&a.enable(!1)})});c.each(["header","footer"],function(a,b){g.Api.register("fixedHeader."+b+"Offset()",function(a){var c=this.context;return a===h?c.length&&c[0]._fixedHeader?c[0]._fixedHeader[b+"Offset"]():h:this.iterator("table",function(c){if(c= +c._fixedHeader)c[b+"Offset"](a)})})});return l}); diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 13db0e495c..8be09fbbbc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -50,6 +50,7 @@ var dataTablesDefaults = { }], "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]], "iDisplayLength": 20, + "fixedHeader": true, initComplete: function( settings) { var tableId = settings.nTable.id // When the DataTables search function is triggered, -- 2.11.0