Performance issue with validateCells

Tags: #<Tag:0x00007fc678268018>

I have 50,000 rows to validate and there are 5 columns. Before saving the data in the table, we call hot.validateCells(). We do this to ensure that valid information is saved to the database. If there aren’t any errors, the validation only takes less than a minute. I think that is very effecient and satisfactory for 50K rows.

However, if there are a lot of invalid cells, the hot.validateCells() could take a very long time to complete. For example, I had a column with a past date. In the afterValidate hook, I return a ‘false’ if the date is less than today. So basically an entire column had a past date and it took an extremely long time (+20) for Handsontable to be come responsive.

I did notice that after awhile, the cells with the bad data were turning red. Cells turning red is normal, I want that, but it was slow updating invalid cells to the red color. On a smaller data set, of course it is faster.

But why is handsontable slower when there are 50,000 errors versus none? The same operations are occuring on all cells regardless if there are errors or not.

I am speculating that in the aftervalidation hook, when I return a false, it is updating that cell to Red and rerendering the table/cell. I know all invalid cells are marked by the htInvalid class. When that occurs, is the performance hit when the cell turns red?

How do I prevent the table from rerendering after each cell is marked htInvalid during the hot.validateCells() call?

I much rather validate all the cells first and then manually call hot.render() only once.

I really hope you are understanding me… haha

Hi @lhs224

Yes, I understand your issue.

We have to wait for ecoRenderer. Here is a link to issue about this feature -
After it, Handsontable should significantly performance boost.
Unfortunately, I can’t determine when we get this feature.

Before that could you try a custom validator?
Here is a link to the tutorial -

Maybe without validateCells your app will be working faster.