Posted 6 February 2019, 12:34 pm EST
If I create a spread sheet from bound data. Where column type is integer. Can I prevent users from typing string values or using fill to enter string values?
Forums Home / Spread / SpreadJS
Posted by: ramakrishna on 6 February 2019, 12:34 pm EST
Posted 6 February 2019, 12:34 pm EST
If I create a spread sheet from bound data. Where column type is integer. Can I prevent users from typing string values or using fill to enter string values?
Posted 7 February 2019, 9:17 am EST
Hello,
You can set the data validator for number cell. For example:
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createNumberValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, “0”, “999999”, true);
dv.showInputMessage(true);
dv.inputMessage(“Value must be a number.”);
dv.inputTitle(“tip”);
dv.showErrorMessage(true);
dv.errorMessage(“Incorrect Value”);
activeSheet.setDataValidator(1, 1, -1, 1, dv, GC.Spread.Sheets.SheetArea.viewport);
This will give error message as soon as user finishes editing the cell.
Thanks,
Deepak Sharma