Hi, my table have nulls in the cell, i want a color instead of a null, is possible?
I try with cell.css and formater but i dont do anything
Thanks
PD: I used the 3.0 version of tabulator
Thanks #
Hey,
you could create a custom formatter to do this:
var nullFormatter = function(cell, formatterParams){
var value = cell.getValue();
if(value == null){
cell.getElement().css("background-color","#f00");
return "";
}else{
return value;
}
};
$("#example-table").tabulator({
columns:[
{title:"Name", field:"name", formatter:nullFormatter}
]
});
Let me know if that helps
Cheers
Oli
Work perfect! Thanks
But when I used this got TypeError
Uncaught (in promise) TypeError: cell.getElement(...).css is not a function
var color_mamnager = function(cell, formatter_params){
var value = cell.getValue();
return value;
if(value > 90){
cell.getElement().css("background-color","red");
return value;
}
}
Hey @midhunp6
Thanks for getting in touch, sorry to hear you are having issues,
Please do not post comments on old posts that have been closed for over a year, please raise a new issue if you are having trouble and use the issue template as it prompts you to answer questions that help us fix your issue.
If you are using version 4.0+ then this is because Tabulator no longer uses jQuery. so the getElement function now returns a DOM node so the correct code to set the background colour would now be:
cell.getElement().style.backgroundColor = "red";
I hope that helps,
Cheers
Oli :)
Hi @olifolkerd
Thank you for the solution, I will keep your advice for the next time issue.
Now your solution is working fine ๐๐
Thank you so much
Cheers โค
Midhun ๐
Most helpful comment
Hi @olifolkerd
Thank you for the solution, I will keep your advice for the next time issue.
Now your solution is working fine ๐๐
Thank you so much
Cheers โค
Midhun ๐