Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: List View Colour

List View Colour 7 months 5 days ago #74182

  • shahidkanwal
  • shahidkanwal's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Karma: 0
Can anybody tell how to change the color of listview through code.
The administrator has disabled public write access.

List View Colour 7 months 4 days ago #74185

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10170
  • Thank you received: 1526
  • Karma: 351
Like this?

docs.suitecrm.com/blog/listview-conditional-formatting/

That one is to apply a different colour to different values, according to some condition in the record.

Or do you just want to change the general styles for List views? In that ase maybe this will help (but you will have to find your way through the CSS)

docs.suitecrm.com/blog/customizing-subthemes/

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

List View Colour 5 days 13 hours ago #85761

  • metfab
  • metfab's Avatar
  • Offline
  • New Member
  • Posts: 6
  • Thank you received: 1
  • Karma: 0
Hello

I try to highlight case status. I followed this method : docs.suitecrm.com/blog/listview-conditional-formatting/ but it doesn't work.
Do you have any idea what is wrong ? I don't have error, but my div is not display.


In /custom/Extension/modules/Cases/Ext/LogicHooks/ListViewHighlight.php
    $hook_array['process_record'][] = Array(
        //Processing index. For sorting the array.
        1,
        //Label. A string value to identify the hook.
        'Highlight Status',

        //The PHP file where your class is located.
        'custom/modules/Cases/HighlightStatusLogicHook.php',

        //The class the method is in.
        'HighlightStatus_class',

        //The method to call.
        'HighlightStatus_method'
    );

In /custom/modules/Cases/HighlightStatusLogicHook.php
 if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class HighlightStatus_class
    {
        // Ajoute une class css autout du statut
		function HighlightStatus_method($bean, $event, $arguments)
        {
            $colour = substr(md5($bean->status),0,6);
			$bean->status = "<div class='status_$colour'>".$bean->status."</div>";
        }
    }
The administrator has disabled public write access.

List View Colour 5 days 12 hours ago #85762

  • AlxGr
  • AlxGr's Avatar
  • Offline
  • Elite Member
  • Posts: 214
  • Thank you received: 40
  • Karma: 5
You are not adding the CSS color properly. CSS goes inside "style". You are adding a random class that has not been declared anywhere.

Follow the sample and test again:
$colour = substr(md5($bean->industry),0,6);
$bean->industry = "<div style='border: solid 5px #$colour;'>".$bean->industry."
Last Edit: 5 days 12 hours ago by AlxGr. Reason: Added more info
The administrator has disabled public write access.

List View Colour 5 days 12 hours ago #85763

  • metfab
  • metfab's Avatar
  • Offline
  • New Member
  • Posts: 6
  • Thank you received: 1
  • Karma: 0
I want to add a css class to manage them in my css file, not a style in the html page.

The problem is not there, the <div...> </div> is not display in the source code (neither with style or class)
The administrator has disabled public write access.

List View Colour 5 days 22 minutes ago #85783

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10170
  • Thank you received: 1526
  • Karma: 351
Check if your logic hook is getting picked up in the QR&R, it should appear in a file somewhere under custom/modules/Ext

Then check if it is getting called when you expect it to. Make the first statement in your logic hook log something as FATAL in suitecrm.log and then check if it's there.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
The following user(s) said Thank You: metfab

List View Colour 4 days 20 hours ago #85809

  • metfab
  • metfab's Avatar
  • Offline
  • New Member
  • Posts: 6
  • Thank you received: 1
  • Karma: 0
Thank you, it was only that ! Just click on Quick Repair and my logic_hook appear !

I have another question : do you know how I can display the Status translation ?
for exemple $bean->status display "Closed_Closed" , and I'd like to display the current language translation
Attachments:
The administrator has disabled public write access.

List View Colour 4 days 19 hours ago #85810

  • metfab
  • metfab's Avatar
  • Offline
  • New Member
  • Posts: 6
  • Thank you received: 1
  • Karma: 0
If finally found for the translation. Here the final code for /custom/modules/Cases/HighlightStatusLogicHook.php
class HighlightStatusLogicHook{

    public function highlightStatus(SugarBean $bean, $event, $arguments){
		global $app_list_strings;
		$appListLabel = $app_list_strings['case_status_dom'];
                $colour = str_replace(" ", "_",$bean->status);
               $bean->status = "<div class='status_$colour'>".$appListLabel[$bean->status]."</div>";
    }
}
The administrator has disabled public write access.
The following user(s) said Thank You: pgr
Time to create page: 0.103 seconds
Powered by Kunena Forum