View source: R/validators_and_renderers.R
register_validator_custom | R Documentation |
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.
register_validator_custom(hot, name, jsFunction)
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. |
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
"
The Handsontable object, hot, with the specified changes applied.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.