How to change the color of a list row if the related view count is zero?

xycofryx

Member
Joomla: 3.8.1
Fabrik 3.8

How to change the color of a list row if the "related data count" is zero?
index.php
 

Attachments

  • Capture.PNG
    Capture.PNG
    86.8 KB · Views: 115
IMO there are two potential ways you could do this.

1. Using the PHP Events list plugin onLoadData event. The wiki has an example of changing the cell colour - you would need to examine the data to see where the related data count is stored and examine the HTML to see how to add the colour (which I would do by adding a class to the <tr> element and providing some custom CSS). Given that there is an example, this should not be difficult to achieve providing that you have sufficient PHP skills to tweak existing code.

2. Using Javascript via the Javascript List plugin to examine the HTML after it is loaded in the browser and adding a class as above. Using jQuery or DOM HTML this would not be difficult providing you have the appropriate Javascript / jQuery / HTML / CSS skills to write new code.

If you need a more detailed steer on how to achieve either of these please ask.
 
Sorry for the late update Sophist. Well anyway my solution was to create a custom.js and add this lines. Thanks for the clue.

$('td:contains("(0)")').closest('tr').css('background-color','#F2DEDE');
 
This is a pretty broad selector. You should probably change `td:...` to include some higher level class selectors that identify the specific list.
 
Well - somewhere in a higher level div will be your list name as a class. So I meant:
Code:
$('.listname td a span:contains("(0)")').closest('tr').css('background-color','#F2DEDE');

Otherwise ANY list containing (0) will get coloured not just this particular list.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top