Hi,
in js of query report, i am calling an api which returns color code,
but and i’ve a function named fun which is responsible to color the row.
but unfortunately function is not working when i call it in frappe.call callback.
its working fine when i call it after frappe.call
here is my code, i’ve added comments to understand clearly.
frappe.query_reports["Test"] = {
"formatter": function(value, row, column, data, default_formatter) {
row = default_formatter(value, row, column, data);
value = default_formatter(value, row, column, data);
var fun = function(color){
value = "<div style='background-color:"+ color +";'>"+ value +"</div>";
}
frappe.call({
method: "erpnext.projects.doctype.projects.projects.get_colors",
args: {
status: data.Status
},
callback: function(response) {
var r = response.message;
//fun(r);
console.log(r);
//Not working
fun("#110000");
}
});
//Working fine
//fun("#110000");
return value;
}
}