Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Questions related to customising nuBuilder Forte with JavaScript or PHP.
ricklincs
Posts: 107 Joined: Mon Aug 01, 2011 5:39 pm
Has thanked: 33 times
Unread post
by ricklincs » Tue Oct 15, 2024 3:56 pm
I use the following on custom code browse and edit to make the row yellow if the 8th column value is 1. (Think I got this off Ke1vin1)
Code: Select all
function rowYellow2() {
$('[data-nu-column="7"]').each(function () {
const cell = $(this);
const row = cell.attr("data-nu-row");
if (cell.html() === "1") {
$('[data-nu-row="' + row + '"]').css("background-color", "#FFE9A5");
}
});
}
if (nuFormType() === 'browse') {
rowYellow2();
}
I would like to do the same on another browse form but this time the column has a date value, I would like to make the row yellow if the date value is 90 days or more than the current date, my javascript skills are limited and have tried using ChatGPT but seem to be getting more and more javascript errors. Anybody any samples of this kind of javascript? Thanks in advance.
steven
Posts: 369 Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times
Unread post
by steven » Tue Oct 15, 2024 10:21 pm
Hi ricklincs,
The trick is getting one of the fields in your Browse to calculate the date difference (and maybe hide this column).
browse.png
So you get something like this...
select.png
Then you should be able to select the hidden column. And change the html value you are looking for.
code2.png
Code: Select all
function rowYellow2() {
$('[data-nu-column="3"]').each(function () {
const cell = $(this);
const row = cell.attr("data-nu-row");
if (cell.html() > "90") { //-- over 90 days
$('[data-nu-row="' + row + '"]').css("background-color", "#FFE9A5");
}
});
}
if (nuFormType() === 'browse') {
rowYellow2();
}
Steven
You do not have the required permissions to view the files attached to this post.
A short post is a good post.