Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

handsontable how to set cell to invalid manually

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 ?

like image 784
user3301396 Avatar asked Jul 06 '14 11:07

user3301396


1 Answers

On version 0.21, maybe newer version than the other answer, this is what worked for me, and seems a bit cleaner:

myHandsOnTable.setCellMeta(rowIndex, colIndex, 'valid', false);
myHandsOnTable.render();

https://docs.handsontable.com/0.21.0/Core.html#setCellMeta

like image 121
Andrew Avatar answered Sep 28 '22 01:09

Andrew