handsontable how to set cell to invalid manually

handsontable, jquery

Solution

You can use the method 'getCellMeta(row, col') to get the cell data then edit the property 'valid' of that cell.

e.g.

var cellMeta = $("#table").handsontable('getCellMeta', row, col);
cellMeta.valid = false;
// Force re-rendering
$("#table").handsontable('render');

The getCellMeta(row,col) method only accept numeric parameters. Do not put the property name of your object as column number.

Best regards,

Problem

I have some handsontable which I use to update information into the db. The first step is: I validate the data, then if an error occurred I fill the row with red color else I just save the information Here come the problem: I call ajax request hard coded I change the style of the td or tr But after I change some value or use the scroll in the table, it calls the inside draw function, and all the colors are backto default How Do I set the cell to be invalid ?

Original source