• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

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