adds a border to the tableWidget and also adds a function that finds the tableunqiueid using the tableInstance

This commit is contained in:
SimonGschnell
2024-04-30 09:48:08 +02:00
parent 20a2e369c5
commit ac0103751d
2 changed files with 21 additions and 9 deletions
+6 -4
View File
@@ -1,7 +1,7 @@
<br>
<div class="row" id="divTableWidgetDataset" tableUniqueId="<?php echo $tableUniqueId; ?>">
<div class="col-lg-12">
<div class="row" id="divTableWidgetDataset" tableUniqueId="<?php echo $tableUniqueId; ?>">
<div class="col-lg-12">
<!-- Table widget header -->
<div id="tableWidgetHeader"></div>
@@ -12,13 +12,15 @@
<div id="tableDatasetActionsTop"></div>
<!-- TableWidget table -->
<div style="border:1px solid lightgrey; border-bottom:none; ">
<?php TableWidget::loadViewDataset(); ?>
</div>
<!-- Table info bottom -->
<div id="tableDatasetActionsBottom"></div>
<!-- Table widget footer -->
<div id="tableWidgetFooter"></div>
</div>
</div>
</div>
@@ -445,6 +445,19 @@ storniert_tooltip = function (e, cell, onRendered) {
}
};
//recursive function that returns the tableuniqueid using the tableInstance
const findTableUniqueID = function (tableElement,count =0){
if(count >=10){
// after 10 iterations end the recursion
return null;
}
if(tableElement.attributes.tableuniqueid){
return tableElement.attributes.tableuniqueid.value;
}else{
findTableUniqueID(tableElement.parentElement, ++count);
}
}
$(function () {
// Pruefen ob Promise unterstuetzt wird
// Tabulator funktioniert nicht mit IE
@@ -454,11 +467,7 @@ $(function () {
//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
let uniqueTableID =
tabulatorInstance.element.parentElement.parentElement.attributes
.tableUniqueId.value;
let uniqueTableID = findTableUniqueID(tabulatorInstance.element);
switch (uniqueTableID) {
case "cancelledLehrauftrag":
@@ -477,6 +486,7 @@ $(function () {
func_rowUpdated(row);
});
break;
// if the function findTableUniqueID returned null because it couldnt find the attribute tableuniqueid
default:
break;
}