- introductie van vue files - bijna werkende versie van eveai_chat_client.
This commit is contained in:
83
nginx/static/assets/js/eveai-tabulator-setup.js
Normal file
83
nginx/static/assets/js/eveai-tabulator-setup.js
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* EveAI Tabulator Setup
|
||||
* Standaard Tabulator configuratie voor consistente tabelweergaven
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Controleer of Tabulator is geladen
|
||||
if (typeof Tabulator !== 'function') {
|
||||
console.warn('Tabulator is niet geladen - overslaan van initialisatie');
|
||||
return;
|
||||
}
|
||||
|
||||
// Zorg ervoor dat de modules correct zijn gedefinieerd
|
||||
if (!Tabulator.modules) {
|
||||
Tabulator.modules = {};
|
||||
}
|
||||
|
||||
if (!Tabulator.modules.format) {
|
||||
Tabulator.modules.format = { formatters: {} };
|
||||
} else if (!Tabulator.modules.format.formatters) {
|
||||
Tabulator.modules.format.formatters = {};
|
||||
}
|
||||
|
||||
// Registreer algemene Tabulator opties en formatters
|
||||
// Gebruik rechtstreekse toewijzing i.p.v. extendModule indien deze functie niet beschikbaar is
|
||||
if (typeof Tabulator.extendModule === 'function') {
|
||||
try {
|
||||
Tabulator.extendModule("format", "formatters", {
|
||||
// Aangepaste formatter voor boolean waarden met mooie iconen
|
||||
"boolean": function(cell, formatterParams){
|
||||
const value = cell.getValue();
|
||||
if (value === true || value === 'true' || value === 1 || value === '1') {
|
||||
return '<i class="fas fa-check text-success"></i>';
|
||||
} else if (value === false || value === 'false' || value === 0 || value === '0') {
|
||||
return '<i class="fas fa-times text-danger"></i>';
|
||||
}
|
||||
return ''; // Geef lege string terug voor null/undefined waarden
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('Fout bij extendModule:', e);
|
||||
// Fallback: rechtstreeks formatters toevoegen
|
||||
Tabulator.modules.format.formatters.boolean = function(cell, formatterParams){
|
||||
const value = cell.getValue();
|
||||
if (value === true || value === 'true' || value === 1 || value === '1') {
|
||||
return '<i class="fas fa-check text-success"></i>';
|
||||
} else if (value === false || value === 'false' || value === 0 || value === '0') {
|
||||
return '<i class="fas fa-times text-danger"></i>';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Directe toewijzing als extendModule niet beschikbaar is
|
||||
Tabulator.modules.format.formatters.boolean = function(cell, formatterParams){
|
||||
const value = cell.getValue();
|
||||
if (value === true || value === 'true' || value === 1 || value === '1') {
|
||||
return '<i class="fas fa-check text-success"></i>';
|
||||
} else if (value === false || value === 'false' || value === 0 || value === '0') {
|
||||
return '<i class="fas fa-times text-danger"></i>';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
}
|
||||
|
||||
// Definieer standaard tabelconfiguratie
|
||||
Tabulator.defaultOptions = {
|
||||
...Tabulator.defaultOptions,
|
||||
layout: "fitColumns",
|
||||
responsiveLayout: false,
|
||||
pagination: "local",
|
||||
paginationSize: 25,
|
||||
paginationSizeSelector: [10, 25, 50, 100],
|
||||
movableColumns: true,
|
||||
tooltips: false,
|
||||
placeholder: "No Data Available",
|
||||
// Verbeterde virtuele DOM-instellingen voor betere prestaties
|
||||
renderVerticalBuffer: 20,
|
||||
virtualDomBuffer: 80
|
||||
};
|
||||
|
||||
console.log('EveAI Tabulator Setup successfully loaded');
|
||||
});
|
||||
Reference in New Issue
Block a user