What is the best way to change cell color based on flag in the data of handsontable ?
i tried the code below but it run slow.
$scope.grayRenderer = function (instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
td.style.background = '#888888';
}
$scope.pinkRenderer = function (instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
td.style.background = 'pink';
}
this.testCaseSetting = {
afterRenderer: function(td,row,col,prop,value,cellProperties){
},
autoColumnSize : true,
autoRowSize : false,
columnSorting : true,
cells: function (row, col, prop) {
if(this.instance.getData().length != 0){
if( this.instance.getData()[row][21] == 1 ){
var cellProperties = {};
if(this.instance.getData()[row][22] == true){
cellProperties.renderer = $scope.grayRenderer;
} else if(this.instance.getData()[row][22] == false){
cellProperties.renderer = $scope.pinkRenderer;
}
return cellProperties;
}
}
},
fillHandle : false,
hiddenColumns : {
columns : [ 0, 19, 20],
indicators : false
},
sortIndicator : true,
stretchH : 'all'
}