Example :
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];
},