register_validator_custom: Register a custom validator with Handsontable

View source: R/validators_and_renderers.R

register_validator_customR Documentation

Register a custom validator with Handsontable

Description

This function turns a string of Javascript into a packaged validator that can then be used in your Handsontable. See details for exact usage information.

Usage

register_validator_custom(hot, name, jsFunction)

Arguments

hot

The Handsontable object to register the validator with.

name

Specify a unique name for the validator, use this name to apply the validator in the rhot::hot_column validator argument.

jsFunction

The custom validator JS function as a string.

Details

You can provide a custom validator by passing the JavaScript code as a string. The string will be glued to a template wrapper function for you, then marked as JavaScript and passed to the Handsontable constructor for registration with the library. Here's an example of a custom validator:

"function customValidator(query, callback)
// this example validator always approves the cell's input
// the query object is the input from the table cell
// put your custom javascript and logic in here
// use the callback to tell the cell whether or not the value is acceptable
callback( false );
// and that's it, everything else is handled by rhot and Handsontable
"

Value

The Handsontable object, hot, with the specified changes applied.


Paul-A-Kavan/rhot documentation built on Oct. 29, 2022, 8:07 a.m.