Hey guys, I’m trying to validate my entire table. My validation function looks at the first 4 columns of each row and verifies that if one cell has a non-null value they all do. The function works well, but when it tries to apply a className htInvalid using setCellMeta and then re-render there’s no class names applied. No error is thrown. Here’s a minimal working example:
https://codepen.io/utnuc/pen/eYawdLx
Using 8.3.2.
Hi @bensmith.md
This problem is caused by the fact that this class is assigned by default to the in-built validators. I think there might be another approach to your problem. Did you consider creating a custom validator that will check this condition? If not, you can use any other custom CSS class that will change the background color. I tried with your red class, and it works fine.
Thanks for the reply, Adrian.
If I change the class name to something different the problem persists. I don’t need validation on every cell change, it only needs to be programmatically triggered before submitting a POST.
@bensmith.md
I can’t fork your example, but when I changed the className from htInvalid to this in both instances:
hot.setCellMeta(row, col, 'className', 'red')
And I try to validate the cells on button click it seems to work correctly. It changes the background color to red when non-null value is present in any cell and it clears it when there is no value.
Oh, snap. You’re totally right. Thanks!!
No problem, I’m glad the issue is solved
In this case I will close this topic.