
Hey Claudio,
the problem is, that the sorting is done AFTER the calculation of the progressive number. Means: You must sort first and then calculate the progressive number. There a multiple ways to achieve that, but for most it's to complicated to explain it here. So here's a simply to explain solution (which is not very elegant :) :
In your first for-loop remove
Prog += Dur[i] || 0
completely. Then in datesNumber.push() replace the variable Prog with Dur[i] and wrap it in a special character (like you do whith the *):
" | §" + Dur[i] + "§ | "
instead of
" | " + Prog + " | "
The next loop can be kept as it is.
Now add a third for-loop (between }; and the table):
var rows = [];
for(var i = 0; i < datesClean.length; i++){
var firstPart = datesClean[i].split("§")[0];
var hrs = datesClean[i].split("§")[1];
var hrs = Number(hrs) || 0;
var thirdPart = datesClean[i].split("§")[2];
var Prog += hrs;
rows.push(firstPart + hrs + thirdPart);
};
And as last line
rows.join("\n")
instead of datesClean.join("\n").
If you get an error parse the first var hrs and var thirdPart to a string: var hrs = String(datesClean[i].split("§")[1]); and: String(datesClean[i].split("§")[2]).
Sometimes that's necessary cause of some "specialities" of the Podio calculation fields.
Rainer