Fork me on GitHub

Handsontable

a minimalistic Excel-like data grid editor for HTML, JavaScript & jQuery

Validation

Use the onBeforeChange callback to validate changes before they are applied to the table.

onBeforeChange (changes: Array, source: String)
Callback fired before one or more cells is changed. Its main purpose is to validate the input. Parameters:
  • changes is a 2D array containing information about each of the edited cells [ [row, prop, oldVal, newVal], ... ].
    • To disregard a single change, set changes[i] to null or remove it from array using changes.splice(i, 1).
    • To alter a single change, overwrite the desired value to changes[i][3].
    • To cancel all edit, return false from the callback or set array length to 0 (changes.length = 0).
  • source is the name of a source of changes.

Callback console: [[row, col, oldValue, newValue], ...]

Edit the above grid to see callback

For more examples, head back to the main page.

Handsontable © 2012 Marcin Warpechowski and contributors.
Code and documentation licensed under the The MIT License.