Page 1 of 2
Browse Form color row
Posted: Wed Dec 14, 2022 12:34 am
by vanman
Hi
Is it possible to color whole row in a browse form based on a date in a column.
I know who to do it for a column but not the whole row
Thanks
Paul
Re: Browse Form color row
Posted: Wed Dec 14, 2022 2:11 am
by kev1n
Example to color the entire row if the first column matches today's date:
Code: Select all
const today = nuCurrentDate(); // retrieve today's date (format yyyy-mm-dd).
// to pass another format: const today = nuCurrentDate('dd.mm.yyyy');
$('[data-nu-column="0"]').each(function (index) { // 0 = 1st column
const id = $(this).attr('id');
const value = $('#' + id).html();
const row = String(id).split('_')[1];
if (value == today) {
$("div[id^='nucell_" + row + "']").css("background-color", "#D4EFDF");
}
});
Re: Browse Form color row
Posted: Wed Dec 14, 2022 2:53 am
by vanman
Thank You
That was quick
Re: Browse Form color row
Posted: Wed Dec 14, 2022 4:35 am
by vanman
Hi Kevin
The row was not colored
used
Code: Select all
$('[data-nu-column="13"]').each(function (index) { // 0 = 1st column
const id = $(this).attr('id');
const value = $('#' + id).html();
const row = String(id).split('_')[1];
if (String(value) == String(today)) {
console.log('v: ' + value + ' t: ' + today)
console.log('r: ' + row);
$("div[id^='nucell_" + row + "']").css("background-color", "#008000");
}
});
Re: Browse Form color row
Posted: Wed Dec 14, 2022 10:38 pm
by vanman
Hi Kevin
If the BB PHP has color code will it override the JS?
Paul
Re: Browse Form color row
Posted: Thu Dec 15, 2022 11:31 am
by kev1n
I don't understand exactly what you mean. What code does BB contain?
Re: Browse Form color row
Posted: Thu Dec 15, 2022 2:00 pm
by vanman
HI Kevin
The BB has a temporary table and color based on date conditions for one column.
I notice in JS the console do show when the conditions are met just the rows do not color
Paul
Re: Browse Form color row
Posted: Thu Dec 15, 2022 2:35 pm
by kev1n
vanman wrote: ↑Thu Dec 15, 2022 2:00 pm
and color based on date conditions for one column.
What does that look like?
Re: Browse Form color row
Posted: Thu Dec 15, 2022 2:51 pm
by vanman
$s1 = "IF(dle_ent_date BETWEEN '$today' AND '$days6', CONCAT('<div class=\"$green\">', ";
$s2 = ",'</div>'), IF(dle_ent_date BETWEEN '$days7' AND '$days13', CONCAT('<div class=\"$orange\">', ";
$s3 = ",'</div>'),";
$s4 = ")) ";
Part of the SQL
CREATE TABLE #TABLE_ID#
SELECT
dle_delord_id,
dle_freight_invoice_extra_text,
{$s1}dle_code{$s2}dle_code{$s3}dle_code{$s4} AS dle_code,
{$s1}dle_docket_no{$s2}dle_docket_no{$s3}dle_docket_no{$s4} AS dle_docket_no,
dle_ent_date AS dle_ent_date_disp,
dle_del_date AS dle_del_date_disp
FROM delord
ORDER BY dle_ent_date_disp DESC, dle_del_date_disp DESC
There are more columns
I have taken over the support of the system
DB Version V.4.5-2021.03.25.00
Files Version V.4.5-2021.03.25.00
Customer does not want to upgrade atm
Paul
Re: Browse Form color row
Posted: Thu Dec 15, 2022 3:06 pm
by kev1n
vanman wrote: ↑Wed Dec 14, 2022 10:38 pm
Hi Kevin
If the BB PHP has color code will it override the JS?
Paul
JS will override the PHP color codes.