ERPNext Conference 2019* ERPNext.com Blog

Coloring cells in reports not working in v12


#1

Hi, i am trying to color cells / rows in query report, the below code is working fine in v10. but its not working in v12.

code :

"formatter":function (row, cell, value, columnDef, dataContext, default_formatter) {
    value = default_formatter(row, cell, value, columnDef, dataContext);
	    if(columnDef.id == "Status"){
		    value = "<span style='font-weight: bold; color:white; background-color:black'>"+ value +"</span>";
	    }
    	    return value;
    	    } 

Error :

VM4988:22 Uncaught (in promise) TypeError: default_formatter is not a function
    at Object.formatter (<anonymous>:22:13)
    at format (query_report.js:724)
    at mt.getCellContent (frappe-datatable.cjs.js:3331)
    at mt.getCellHTML (frappe-datatable.cjs.js:3295)
    at frappe-datatable.cjs.js:4159
    at Array.map (<anonymous>)
    at wt.getRowHTML (frappe-datatable.cjs.js:4159)
    at Object.generate (frappe-datatable.cjs.js:4650)
    at e.value (frappe-datatable.cjs.js:4419)
    at e.value (frappe-datatable.cjs.js:4502)

Script Report color format error
#2

Solved.