Highlighting Specific Records

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Highlighting Specific Records

Post by federico » 2020-12-02 13:36

Hi pböttcher

you are right, sorry... the child table is Agenda and the parent is Clienti. I understood from the beginning of this post that I had to use:
".parent-child-field"
meanwhile I just need to write ".child-field" only so the code is ".Agenda-Stato"
With this last code it works perfectly.

thank you very much!

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Highlighting Specific Records

Post by federico » 2020-12-02 14:13

Hi all
so the correct code (for any future request) to use to highlight the row of a childtable is:

<script>
$j(function() {
function wait_for(data,callback,time=100) {
if($j(data).length != 0) {
callback();
return;
}
else {
setTimeout(function() {
wait_for(data,callback, time);
}, time);
}
}
wait_for('.table-striped',function() {
$j('.TABLENAME-FIELDNAME').each(function(){
var Stato = $j(this).text();
if(FIELDNAME == 'RECORDNAME1'){
$j(this).parents('tr').addClass('warning');
}
if(FIELDNAME == 'RECORDNAME2'){
$j(this).parents('tr').addClass('danger');
}
if(FIELDNAME == 'RECORDNAME3'){
$j(this).parents('tr').addClass('success');
}
})
})
})
</script>

replace TABLENAME - FIELDNAME - RECORDNAME1 - RECORDNAME2 and RECORDNAME3 with your data or delete the RECORDNAMENUMBER part if you don't use.

I hope this helps

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Highlighting Specific Records

Post by federico » 2021-06-13 20:17

I have to open this post again because I have another problem... color the text:

Code: Select all

		$j('.Listini_Clienti-LEPREZ').each(function(){
			var Prezzo = $j(this).text();
			if(Prezzo => 0){
				$j(this).children('a').css('color',"#4dbbff")
			}
		})
This changes the entire column of the Prezzo (Price) in blue in the table view. Why it doesn't work for the child table? Of course it's inside the wait_for function

and why I can't see it detail view too?
:x

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Highlighting Specific Records

Post by pbottcher » 2021-06-14 18:27

Hi,

because the child table does not have an "a" tag, so your $j(this).children('a') does not match anything.
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.

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Highlighting Specific Records

Post by federico » 2021-06-15 13:35

Thanks pböttcher
How can I fix it? I tried so many combinations :-(

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Highlighting Specific Records

Post by pbottcher » 2021-06-15 18:20

try

Code: Select all

		$j('.Listini_Clienti-LEPREZ').each(function(){
			var Prezzo = $j(this).text();
			if(Prezzo => 0){
				if ($j(this).children('a').length == 0) {
					$j(this).css('color',"#4dbbff")
				}
				else {
					$j(this).children('a').css('color',"#4dbbff")
				}
			}
		})
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.

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Highlighting Specific Records

Post by federico » 2021-06-17 19:44

You are magic!!! Thank you so much!!!

Post Reply