I have a simple handsontable, which get its data from a database, but not all the cells will have data,some will have just null values. Instead of handsontable showing the empty cell in the table, is it possible to put a number formatter with values like 0.00 by default??
Here is solution. please check and let me know if not working. i have tested it on jsfiddle > http://jsfiddle.net/yL8t1psf/1/
$(document).ready(function () {
var container = document.getElementById('basic_example');
var data = [
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
['2014', 10, 11, 12, 13],
['2015', 20, null, , 13],
['2016', null, 15,'', null]
];
var hot = new Handsontable(container, {
data: data,
height: 396,
colHeaders: true,
rowHeaders: true,
stretchH: 'all',
columnSorting: true,
contextMenu: true,
cells: function (row, col, prop,value) {
var cellProperties = {};
cellProperties.renderer = firstRowRenderer;
return cellProperties;
}
});
});
function firstRowRenderer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
if(!value || value === '' || value == null ) {
td.innerHTML = "0.00";
}
}