var instance; // Type: wijmo.grid.IDetailSettings; var value; // Type: any value = instance.beforeCellUpdate;
var beforeCellUpdate : any;
The beforeCellUpdate event handler is a function that is called before the cell is updated with new or user-entered data. This event is cancellable if the editingMode options is set to "cell". There are many instances where this event is helpful, such as when you need to check a cell's value before the update occurs or when you need to apply an alert message based on the cell's value.
var instance; // Type: wijmo.grid.IDetailSettings; var value; // Type: any value = instance.beforeCellUpdate;
var beforeCellUpdate : any;
// In this sample, you use args.value to check the year that the user enters in the "Acquired" column. // If it's less than 1990 or greater than the current year, then the event handler will return false to cancel updating and show the user an alert message. $("#element").wijgrid({ beforeCellUpdate: function(e, args) { switch (args.cell.column().dataKey) { case "Acquired": var $editor = args.cell.container().find("input"), value = $editor.wijinputnumber("getValue"), curYear = new Date().getFullYear(); if (value < 1990 || value > curYear) { $editor.addClass("ui-state-error"); alert("value must be between 1990 and " + curYear); $editor.focus(); return false; } args.value = value; break; } } });