-
mfilipe
- Posts: 12
- Joined: 2020-01-18 17:18
Post
by mfilipe » 2022-02-07 12:40
Hi Appgini community,
Need help with this script
Code: Select all
$j(function () {
/* highlight unpaid invoices in table view */
$j('td.cf-cf_exp_date').each(function () {
var td = $j(this);
var td = td.parents('tr');
var dueDateTd = td.find('.cf-cf_exp_date');
var dueDate = moment(dueDateTd.text(), AppGini.datetimeFormat());
var today = moment().format('YYYY-MM-DD');
var inProdu = document.querySelector('td.cf-cf_in_production').textContent;
if (dueDate.isBefore(today)) {
td.find('.cf-cf_exp_date').addClass('danger');
td.find('.cf-cf_exp_date').addClass('text-danger');
td.find('.cf-cf_exp_date').addClass('text-bold');
} else if (dueDate.isSame(today)) {
td.find('.cf-cf_exp_date').addClass('warning');
td.find('.cf-cf_exp_date').addClass('text-warning text-bold');
}
if (inProdu =! null) {
td.find('.cf-cf_in_production').addClass('success');
td.find('.cf-cf_in_production').addClass('text-info');
td.find('.cf-cf_in_production').addClass('text-bold');
}
})
})
In
dueDate works fine, but take all
inProdu td.cf-cf_in_production as success class.
-
Attachments
-

- Capturar.PNG (158.58 KiB) Viewed 2112 times
-
pbottcher
- AppGini Super Hero

- Posts: 1709
- Joined: 2018-04-01 10:12
Post
by pbottcher » 2022-02-08 07:49
Hi,
try to replace
Code: Select all
var inProdu = document.querySelector('td.cf-cf_in_production').textContent;
with
Code: Select all
var inProdu = $j('#cf-cf_in_production-'+$j(this).parent().attr('data-id')).text();
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
mfilipe
- Posts: 12
- Joined: 2020-01-18 17:18
Post
by mfilipe » 2022-02-14 10:00
pböttcher,
still the same problem
-
pbottcher
- AppGini Super Hero

- Posts: 1709
- Joined: 2018-04-01 10:12
Post
by pbottcher » 2022-02-14 12:10
Hi,
the text is actually not empty, so the comparison != null gives always true.
either try
or try
Code: Select all
var inProdu = $j('#cf-cf_in_production-'+$j(this).parent().attr('data-id')).text().trim();
and
Also watch the ! (not) syntax.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
mfilipe
- Posts: 12
- Joined: 2020-01-18 17:18
Post
by mfilipe » 2022-02-15 14:20
It works!!!!
Thank you so much pböttcher!!!