I have a datagrid with easyui, i create dynamically the headers since they depend on my database. i have gotten my header right already. this is the json object being passed to the datagrid.
[[
{"field": "status","title": "Estatus","align": "center","rowspan": "2"},
{"field": "Numero","title": "Orden","align": "center","rowspan": "2"},
{"field": "FechaRegistro","title": "Fecha","align": "center","rowspan": "2"},
{"field": "T1","title": "00:02:00","align": "center"},
{"field": "T2","title": "00:24:00","align": "center"},
{"field": "T3","title": "00:04:00","align": "center"},
{"field": "T4","title": "02:00:00","align": "center"},
{"field": "Cierre","title": "Fecha y Hora<br \/>de Cierre","align": "center","rowspan": "2"}
],[
{"field": "P1","title": "Informacion <br\/>tecnica para <br\/>aprobacion","align": "center","formatter": "formatColor()"},
{"field": "P2","title": "Aprobacion de<br\/> Informacion<br\/>Tecnica cliente","align": "center","formatter": "formatColor()"},
{"field": "P3","title": "Informacion<br\/>Tecnica de<br\/>Proceso","align": "center","formatter": "formatColor()"},
{"field": "P4","title": "Compra y<br\/>Recepcion de<br\/>Materiales","align": "center","formatter": "formatColor()"}
]]
and i am having a function in my .js
function formatColor(val,row){
if (val < 20){
return '<span style="color:red;">('+val+')</span>';
console.log(row);
} else {
return val;
console.log(row);
}
}
but i get this in my console as error.
Uncaught TypeError: col.formatter is not a function
my grid is being populated with a query every second with some times in the P1,P2,P3,P4 columns, the T1,T2,T3,T4 are just the established time that that column should take. So I am trying to make that if my column value is higher than it it will become red background. But i am trying to at least call the function formatter and i cant even get to that. i got this idea from the API and the this example, the difference is that i am generating the columns dynamically, and my function is not being called so i cant move forward.
Thanks,