How to add CSS color to other field (ex: full_name) base on Type (fieldname Select) in listview?

Example :

Screenshot 2025-03-04 164851

Some references

This code works, but Iā€™m afraid that if the user clicks to view 2500 records, it will be slow because it loops to check if candidate_type == "Black List", as you can see.

refresh: function(listview){
        listview.data.forEach(doc => {
            if (doc.candidate_type == "Black List") {
                document.querySelector(a[data-name="${doc.name}"]).style.color = 'red';
            }
        });
    },

So, is there any solution, like using the get_indicator function, where we can set it without looping?

For example, I tried using the get_indicator function, but it does not work correctly as expected.

get_indicator: function(doc) {
        const cand_type_colors = {
      "Black List": "red",
            "Confidential": "blue"
    };
    return [__(doc.full_name), cand_type_colors[doc.candidate_type], "candidate_type,=,"+doc.candidate_type];
    },

Reference: How to set Listview indicators to anyfield - #7 by NCP

1 Like