handsontable / vue-handsontable-official

Vue Data Grid with Spreadsheet Look & Feel. Official Vue wrapper for Handsontable.
https://handsontable.com/docs/vue
MIT License
746 stars 128 forks source link

How to use validator when use HotColumn #200

Closed muei closed 4 years ago

muei commented 4 years ago

If use the Vue/React component like HotColumn, how to use validator? Should I implement by self?

AMBudnik commented 4 years ago

Hi @muei

Here's an example https://jsfiddle.net/cL1fdjym/ of a validator added to a single column using HotColumn syntax. If you'd like something more than that please let me know.

muei commented 4 years ago

Thanks for reply, but in the demo, should focus the cell input then trigger the vadlitor, can not auto validate.

AMBudnik commented 4 years ago

By default, validator is triggered when a cell is changed. It happens for the cell that is changed, not for all the values. Can you share an example (or a drawing) what would be an expected behavior?

muei commented 4 years ago

I share a common usage case, user import a excel and set the type of column, and hope handsontable show invalid cells which not match the type immediately, this will helped to correct the value.

AMBudnik commented 4 years ago

Oh, OK, I see it now. You can use the validateCells on the data load. Here's an example https://jsfiddle.net/u0vf8mdc/