Hello All, using version 5.75
Has anyone got this to work? I have made several attempts and it doesn't work. And, yes I did substitute the tablename and fieldname.
$header="<%%HEADER%%><script>\$j(function(){
\$j('td.tablename-fieldname').each(function(){
if(\$j(this).text() == 'Important'){
\$j(this).parent().addClass('danger');
}
})
})</script>";
Changing Color - Has anyone got this to work?
Re: Changing Color - Has anyone got this to work?
Hi,
try
try
Code: Select all
$header="<%%HEADER%%><script>\$j(function(){
\$j('.tablename-fieldname').each(function(){
if(\$j(this).text() == 'Important'){
\$j(this).parent().addClass('danger');
}
})
})</script>";
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.
Re: Changing Color - Has anyone got this to work?
Did you define you own .danger class in CSS?
If not, you should do so or use bootstrap's 'text-danger' class or 'bg-danger' class instead of 'danger'.
Best,
Jan
PS: double check that .text() returns 'Important' with identical character casing and no whitespaces
If not, you should do so or use bootstrap's 'text-danger' class or 'bg-danger' class instead of 'danger'.
Best,
Jan
PS: double check that .text() returns 'Important' with identical character casing and no whitespaces
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Changing Color - Has anyone got this to work?
Hello,
Thanks to the both of you, the code that pbottcher supplied worked when I added the bootstrap class that jsetzer suggested. Thanks again.
Thanks to the both of you, the code that pbottcher supplied worked when I added the bootstrap class that jsetzer suggested. Thanks again.
Re: Changing Color - Has anyone got this to work? - Not working on server
Ok,
No this is a mystery. The code suggested works perfectly as intended on my local Windows machine but when uploaded to my server it doesn't work. It's a Linux server running PHP Version 7.2.16 if that is any help. I have tried a few variations of the syntax such as upper and lower case names and well as changing the class (which shouldn't matter) but it does not work. Any thoughts?
No this is a mystery. The code suggested works perfectly as intended on my local Windows machine but when uploaded to my server it doesn't work. It's a Linux server running PHP Version 7.2.16 if that is any help. I have tried a few variations of the syntax such as upper and lower case names and well as changing the class (which shouldn't matter) but it does not work. Any thoughts?
Re: Changing Color - Has anyone got this to work?
Hmmm, strange.
Can you please check the console output in you browser's developer tools to see if there is any javascript error and also check if any bootstrap-related file (css/js) could not be loaded.
If there is no error, you should ensure that your script get's executed at all for example by inserting console.log('...') in your js-code and watch the output:
Regards,
Jan
Can you please check the console output in you browser's developer tools to see if there is any javascript error and also check if any bootstrap-related file (css/js) could not be loaded.
If there is no error, you should ensure that your script get's executed at all for example by inserting console.log('...') in your js-code and watch the output:
Code: Select all
$header="<%%HEADER%%><script>\$j(function(){
console.log('document ready');
console.log('number of elements:');
console.log(\$j('td.tablename-fieldname').length);
\$j('td.tablename-fieldname').each(function(){
console.log(\$j(this).text());
if(\$j(this).text() == 'Important'){
console.log('equal');
\$j(this).parent().addClass('text-danger');
} else {
console.log('not equal');
}
})
})</script>";
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Changing Color - Has anyone got this to work?
Hello,
Thanks for the console tip. I had a look one of the problems I had was a script that I had put in the footer-extras.php file to get Chrome to not cache the a javascript. I took it out, the detail view colour change works, the table view doesn't but I can live with it. I added an alert in the common.js.php file to pop up as a warning. However I did find something else interesting the following resource could not be found:
https://mywebsite/myproject/resources/l ... ox.min.map. However my Lightbox features work so I am not sure what the problem is without trying to examine a pile of code where I wouldn't know where to start.
Thanks for the console tip. I had a look one of the problems I had was a script that I had put in the footer-extras.php file to get Chrome to not cache the a javascript. I took it out, the detail view colour change works, the table view doesn't but I can live with it. I added an alert in the common.js.php file to pop up as a warning. However I did find something else interesting the following resource could not be found:
https://mywebsite/myproject/resources/l ... ox.min.map. However my Lightbox features work so I am not sure what the problem is without trying to examine a pile of code where I wouldn't know where to start.
Re: Changing Color - Has anyone got this to work?
So to conclude this string. I added a line to the common.js.php file to create an alert when the record he or she is creating results in a the value that would prompt a colour change. As a result the record is not accepted and the user has to go back and edit the record so the value is not produced. Either way it is a win for me as the end result is what I was after anyway. Gotta love trial and error learning!
Also a big shout out to those folks on here like pboettcher and jsetzer that devote a lot of time to helping us newbies find our way.
Thanks!
Also a big shout out to those folks on here like pboettcher and jsetzer that devote a lot of time to helping us newbies find our way.
Thanks!