Page 1 of 1

colored fonts date-field if previus today

Posted: 2019-09-17 10:26
by G Belgrado
in table view
I have a field date (d-m-Y format) but (Y-m-d in db format)
how can I do for
have date-field colored red
if date-field previous to today

thanks

Re: colored fonts date-field if previus today

Posted: 2019-09-18 19:46
by pbottcher
Hi,

you can use the hooks/TABLENAME.php file and within the header function you can add the following (assuming you use tableview only):

Code: Select all

	case 'tableview':
		$header="<%%HEADER%%><script type=\"text/javascript\">
				\$j(function(){
					\$j('td.parent-when_provided a').each(function() {
				//	ADD YOUR CODE TO COMPARE THAT DATE AGAINST TODAY DATE
						if ( CHECK IS POSITIV) {
							\$j(this).css('color', 'red');
						}
					});
				});	
		</script>";
		break;