Hello,
I have a nice live table with multiple columns containing some dates and I need to display some lines depending of dates value (and/or dates intervals)
ie I have this live table:
Name | StartDate | EndDate
toto | 01/01/2018 | 31/01/2018
…
I want to display in red lines if the EndDate is anterior than StartDate or if (EndDate - StartDate) is inferior than 4 days, etc.
I don’t think it is possible with CSS only?
Could you give me some ways to customize my live table with date?
Can I add a calculated field in my live table?
Finally, with a JSX (javascript), I use something like:
require(['jquery'], function ($) {
document.observe("xwiki:livetable:MesEtudesAmonts:loadingComplete", function(){
SurligneTable('#MesEtudesAmonts', '.P4_RapportFinEnvoi', '.P1_DateFin');
});
...
});
function SurligneTable(MyTable, RefDateVide, RefDateFin) {
const Aujourdhui = new Date();
// Ligne dont RefDateVide ("P4_RapportFinEnvoi" ou "") est vide
var MaLigne = $(MyTable + " td" + RefDateVide + ".typedate:empty").parents('tbody.xwiki-livetable-display-body > tr');
// Boucle sur les lignes où RefDateVide est vide
// recup des dates des lignes où Fin E () est vide
MaLigne.each(function(){
var currentRow=$(this);
var DateFinStr = currentRow.find(RefDateFin).text();
var DateFinSplit =DateFinStr.split('/');
// Please pay attention to the month (parts[1]); JavaScript counts months from 0:
// January - 0, February - 1, etc.
var DateFin = new Date(DateFinSplit[2], DateFinSplit[1] - 1, DateFinSplit[0]);
...
currentRow.css("background-color", MyColor);