From 691bbaaf82b920292ee27937877f397ad29e2e98 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 12 Mar 2024 09:59:21 +0100 Subject: [PATCH] workaround for tabulator jquery_wrapper --- .../approveAnrechnungUebersichtData.php | 9 +- application/views/templates/FHC-Footer.php | 2 +- public/js/tabulator/jquery_wrapper.js | 84 +++++++++++++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 public/js/tabulator/jquery_wrapper.js diff --git a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php index 879fe12b6..24a49bed2 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php +++ b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php @@ -225,12 +225,13 @@ $filterWidgetArray = array( func_rowFormatter(row,this); }, columnDefaults:{ - tooltip:true, - } + tooltip:true + }, //! not working columnDefaults:{ - tooltip:function(e, cell, onRendered){ - return func_tooltips(cell); + tooltip:function(e, cell, onRendered){ + return func_tooltips(cell); + } } }', // tabulator properties 'datasetRepFieldsDefs' => '{ diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index c17e49de7..1bec5984e 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -100,7 +100,7 @@ // Tabulator 5 JS if ($tabulator5 === true) generateJSsInclude('vendor/olifolkerd/tabulator5/dist/js/tabulator.min.js'); // Tabulator 5 JQuery - if ($tabulator5JQuery === true) generateJSsInclude('vendor/olifolkerd/tabulator5/dist/js/jquery_wrapper.js'); + if ($tabulator5JQuery === true) generateJSsInclude('public/js/tabulator/jquery_wrapper.js'); // Tinymce 3 JS if ($tinymce3 === true) generateJSsInclude('include/tiny_mce/tiny_mce.js'); diff --git a/public/js/tabulator/jquery_wrapper.js b/public/js/tabulator/jquery_wrapper.js new file mode 100644 index 000000000..9b11095ec --- /dev/null +++ b/public/js/tabulator/jquery_wrapper.js @@ -0,0 +1,84 @@ +/* + * This file is part of the Tabulator package. + * + * (c) Oliver Folkerd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Full Documentation & Demos can be found at: http://olifolkerd.github.io/tabulator/ + * + */ + +(function (root, factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + define(['jquery', 'tabulator', 'jquery-ui'], factory); + } + else if(typeof module !== 'undefined' && module.exports) { + module.exports = factory( + require('jquery'), + require('tabulator'), + require('jquery-ui') + ); + } + else { + factory(root.jQuery, root.Tabulator); + } +}(this, function ($, Tabulator) { + + $.widget("ui.tabulator", { + _create:function(){ + var options = Object.assign({}, this.options); + var props = []; + + delete options.create; + delete options.disabled; + + this.table = new Tabulator(this.element[0], options); + window.table = this.table; + + console.log(this.table); + props = Object.getOwnPropertyNames(Object.getPrototypeOf(Object.getPrototypeOf(this.table))); + props = props.concat(Object.getOwnPropertyNames(this.table)); + console.log(props); + + const that = this; + this.table.on("tableBuilt", function(){ + console.log('bhbuilt begin'); + console.log(this); + props = Object.getOwnPropertyNames(Object.getPrototypeOf(Object.getPrototypeOf(this))); + props = props.concat(Object.getOwnPropertyNames(this)); + for(let key of props){ + if( key === 'download' ) console.log('download: ' + typeof this[key]); + if(typeof this[key] === "function" && key.charAt(0) !== "_"){ + that[key] = this[key].bind(this); + } + } + console.log(props); + console.log('bhbuilt end'); + }); + + //retrieve properties on prototype + props = Object.getOwnPropertyNames(Object.getPrototypeOf(Object.getPrototypeOf(this.table))); + + //retrieve properties added by modules + props = props.concat(Object.getOwnPropertyNames(this.table)); + + //map tabulator functions to jquery wrapper + for(let key of props){ + if(typeof this.table[key] === "function" && key.charAt(0) !== "_"){ + this[key] = this.table[key].bind(this.table); + } + } + }, + + _setOption: function(option, value){ + console.error("Tabulator jQuery wrapper does not support setting options after the table has been instantiated"); + }, + + _destroy: function(option, value){ + this.table.destroy(); + }, + }); +}));