Use when creating or modifying a Handsontable cell validator - async callback-based validation functions that determine if cell values are valid
Validators use the callback pattern and must always invoke the callback:
function myValidator(value, callback) {
// `this` is bound to the cell's cellProperties object
if (this.allowEmpty && (value === null || value === void 0 || value === '')) {
return callback(true);
}
callback(isValid(value)); // true = valid, false = invalid
}
callback hangs the validation pipeline.this is the cell's cellProperties object. Use this.allowEmpty, this.instance (the Handsontable instance), and other cell meta properties.src/validators/{validatorName}/
{validatorName}.js # Validator function
index.js # Re-exports
Registry: src/validators/registry.js.
import { registerValidator } from '../../validators/registry';
registerValidator('myValidator', myValidator);
finishEditing().validateCells(), validateRows(), or validateColumns() API methods.htInvalid CSS class (applied by the renderer pipeline, not the validator).src/validators/numericValidator/numericValidator.js -- Numeric validation with allowEmpty support.src/validators/dateValidator/dateValidator.js -- Date format validation.src/validators/autocompleteValidator/autocompleteValidator.js -- Validates against a list of allowed values.callback, which silently blocks editing and validation.this.allowEmpty for empty values.this binding to cellProperties).