diff --git a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php index 398389e90..6dbd9e2a7 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php +++ b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php @@ -226,10 +226,13 @@ $filterWidgetArray = array( func_rowFormatter(row,this); }, columnDefaults:{ - headerFilterPlaceholder: " ", + + //columnDefaults tooltip did not work + tooltip:function(e, cell, onRendered){ return func_tooltips(cell); - } + }, + headerFilterPlaceholder: " ", } }', // tabulator properties diff --git a/application/views/lehre/anrechnung/reviewAnrechnungUebersichtData.php b/application/views/lehre/anrechnung/reviewAnrechnungUebersichtData.php index b88617ced..c7b6a5089 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungUebersichtData.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungUebersichtData.php @@ -172,8 +172,13 @@ $filterWidgetArray = array( func_rowFormatter(row); }, columnDefaults:{ + + //columnDefaults tooltip did not work + + tooltip:(cell)=>{tooltip:function(e, cell, onRendered){ + func_tooltips(e,cell,onRendered); + }, headerFilterPlaceholder: " ", - tooltip:(cell)=>{func_tooltips(cell)}, } diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 6c65559d9..96345288e 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -9,7 +9,9 @@ $this->load->view( 'bootstrap3' => true, 'fontawesome4' => true, 'sbadmintemplate' => false, - 'tabulator4' => true, + 'tabulator5' => true, + 'tabulator5JQuery' => true, + 'cis'=>true, 'momentjs2' => true, 'ajaxlib' => true, 'dialoglib' => true, diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index fcd9b953c..0a4674e12 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -330,7 +330,7 @@ $filterWidgetArray = array( height: func_height(this), layout: "fitColumns", // fit columns to width of table autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated - headerFilterPlaceholder: " ", + index: "row_index", // assign specific column as unique id (important for row indexing) selectable: true, // allow row selection selectableRangeMode: "click", // allow range selection using shift end click on end of range @@ -338,24 +338,16 @@ $filterWidgetArray = array( selectableCheck: function(row){ return func_selectableCheck(row); }, - rowUpdated:function(row){ - func_rowUpdated(row); - }, rowFormatter:function(row){ func_rowFormatter(row); }, - tableBuilt: function(){ - func_tableBuilt(this); - }, - renderComplete:function(){ - func_renderComplete(this); - }, - renderStarted:function(){ - func_renderStarted(this); - }, + tableWidgetFooter: { selectButtons: true - } + }, + columnsDefaults:{ + headerFilterPlaceholder: " ", + } }', // tabulator properties 'datasetRepFieldsDefs' => '{ row_index: {visible:false}, // necessary for row indexing diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index 4900a91c4..5a9323108 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -404,7 +404,7 @@ $filterWidgetArray = array( vertrag_id: {visible: false}, vertrag_stunden: {visible: false}, vertrag_betrag: {visible: false}, - mitarbeiter_uid: {visible: false, headerFilter:"input"},func_initialFilter + mitarbeiter_uid: {visible: false, headerFilter:"input"}, bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip}, erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip}, akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip}, diff --git a/public/js/TableWidget.js b/public/js/TableWidget.js index 57a03e665..69b7d79cf 100644 --- a/public/js/TableWidget.js +++ b/public/js/TableWidget.js @@ -727,7 +727,6 @@ var FHC_TableWidget = { _getRepresentationFieldsDefinitions: function(data) { var fieldsDefinitions = {}; // eventually contains record fields definitions - // Checks if record fields definitions was given as parameter if (data.hasOwnProperty("datasetRepresentationFieldsDefinitions") && data.datasetRepresentationFieldsDefinitions != "") { diff --git a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js index 123049ed7..b7f19a015 100644 --- a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js +++ b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js @@ -203,16 +203,16 @@ function func_rowSelectionChanged(data, rows, tabulatorInstance){ } // Returns tooltip -function func_tooltips(e, cell, onRendered){ +function func_tooltips(){ //e - mouseover event //cell - cell component //onRendered - onRendered callback registration function - - console.log("TOOLTIP DEBUG",cell); - // Return tooltip if row is unselectable - if (true || !func_selectableCheck(cell.getRow())){ - return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status'; - } + console.log("here"); + // console.log("TOOLTIP DEBUG",cell); + // // Return tooltip if row is unselectable + // if (true || !func_selectableCheck(cell.getRow())){ + // return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status'; + // } } // Formats empfehlung_anrechnung diff --git a/public/js/lehre/lehrauftrag/acceptLehrauftrag.js b/public/js/lehre/lehrauftrag/acceptLehrauftrag.js index 08a0645bc..c8f5b88bd 100644 --- a/public/js/lehre/lehrauftrag/acceptLehrauftrag.js +++ b/public/js/lehre/lehrauftrag/acceptLehrauftrag.js @@ -51,7 +51,7 @@ var mut_formatStringDate = function(value, data, type, params, component) { // ----------------------------------------------------------------------------------------------------------------- // Formats null values to a string number '0.00' -var form_formatNulltoStringNumber = function(cell, formatterParams){ +var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){ if (cell.getValue() == null){ if (formatterParams.precision == 1) { @@ -69,7 +69,7 @@ var form_formatNulltoStringNumber = function(cell, formatterParams){ // ----------------------------------------------------------------------------------------------------------------- // Filters values using comparison operator or just by string comparison -function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){ +function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){ // If string starts with <, <=, >, >=, !=, ==, compare values with that operator var operator = ''; @@ -346,7 +346,11 @@ status_formatter = function(cell, formatterParams, onRendered){ }; // Generates status tooltip -status_tooltip = function(cell){ +status_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + var bestellt = cell.getRow().getData().bestellt; var erteilt = cell.getRow().getData().erteilt; var akzeptiert = cell.getRow().getData().akzeptiert; @@ -403,7 +407,11 @@ status_tooltip = function(cell){ } // Generates bestellt tooltip -bestellt_tooltip = function(cell){ +bestellt_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + if (cell.getRow().getData().bestellt_von != null) { return FHC_PhrasesLib.t("ui", "bestelltVon") + cell.getRow().getData().bestellt_von; @@ -411,21 +419,33 @@ bestellt_tooltip = function(cell){ } // Generates erteilt tooltip -erteilt_tooltip = function(cell){ +erteilt_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + if (cell.getRow().getData().erteilt_von != null) { return FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von; } } // Generates akzeptiert tooltip -akzeptiert_tooltip = function(cell){ +akzeptiert_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + if (cell.getRow().getData().akzeptiert_von != null) { return FHC_PhrasesLib.t("ui", "angenommenVon") + cell.getRow().getData().akzeptiert_von; } } // Generates storniert tooltip -storniert_tooltip = function(cell){ +storniert_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + if (cell.getRow().getData().storniert_von != null) { return FHC_PhrasesLib.t("ui", "storniertVon") + cell.getRow().getData().storniert_von; } @@ -434,6 +454,21 @@ storniert_tooltip = function(cell){ $(function() { // Pruefen ob Promise unterstuetzt wird // Tabulator funktioniert nicht mit IE + + + // tableInit is called in the jquery_wrapper when the tableBuilt event was finished + $(document).on("tableInit", function(event,tabulatorInstance) { + + //passing the tabulator instance because the acceptLehrauftrag site loads two tabulator tables + func_tableBuilt(tabulatorInstance) + + // using the tabulator instance instead of the jquery object because the site loads two different tabulator tables + tabulatorInstance.on("renderComplete",()=>{func_renderComplete(tabulatorInstance)}); + tabulatorInstance.on("renderStarted",()=>{func_renderStarted(tabulatorInstance)}); + tabulatorInstance.on("rowUpdated",(row)=>{func_rowUpdated(row)}); + + }); + var canPromise = !! window.Promise; if(!canPromise) { diff --git a/public/js/lehre/lehrauftrag/approveLehrauftrag.js b/public/js/lehre/lehrauftrag/approveLehrauftrag.js index f40742617..6ce0414fa 100644 --- a/public/js/lehre/lehrauftrag/approveLehrauftrag.js +++ b/public/js/lehre/lehrauftrag/approveLehrauftrag.js @@ -225,7 +225,7 @@ function func_selectableCheck(row){ // Adds column status function func_tableBuilt(table) { // Add status column to table - table.addColumn( + table.tabulator("addColumn", { title: "", field: "status", @@ -402,7 +402,11 @@ status_formatter = function(cell, formatterParams, onRendered){ }; // Generates status tooltip -status_tooltip = function(cell){ +status_tooltip = function(e, cell, onRendered){ + //e - mouseover event + //cell - cell component + //onRendered - onRendered callback registration function + var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null); var bestellt = cell.getRow().getData().bestellt; @@ -504,6 +508,17 @@ akzeptiert_tooltip = function(e, cell, onRendered){ } $(function() { + // tableInit is called in the jquery_wrapper when the tableBuilt event was finished + $(document).on("tableInit", function(event,tabulatorInstance) { + + func_tableBuilt($("#tableWidgetTabulator")) + + // event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5 + $("#tableWidgetTabulator").tabulator("on","renderStarted",()=>func_renderStarted(tabulatorInstance)); + $("#tableWidgetTabulator").tabulator("on","rowUpdated",(row)=>func_rowUpdated(row)); + + }); + // Redraw table on resize to fit tabulators height to windows height window.addEventListener('resize', function(){ $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50); diff --git a/public/js/lehre/lehrauftrag/orderLehrauftrag.js b/public/js/lehre/lehrauftrag/orderLehrauftrag.js index e1be95d7f..9eb5da144 100644 --- a/public/js/lehre/lehrauftrag/orderLehrauftrag.js +++ b/public/js/lehre/lehrauftrag/orderLehrauftrag.js @@ -70,7 +70,7 @@ var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){ // ----------------------------------------------------------------------------------------------------------------- // Filters values using comparison operator or just by string comparison -function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){ +function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){ // If string starts with <, <=, >, >=, !=, ==, compare values with that operator var operator = ''; diff --git a/public/js/tabulator/jquery_wrapper.js b/public/js/tabulator/jquery_wrapper.js index e5ef2e088..a5ccb92b0 100644 --- a/public/js/tabulator/jquery_wrapper.js +++ b/public/js/tabulator/jquery_wrapper.js @@ -47,6 +47,7 @@ that[key] = this[key].bind(this); } } + console.log("here the table is building") $(document).trigger("tableInit",[this]); });