可以参考下面的代码
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createNumberValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, "5", "20", true);
dv.showInputMessage(false);
dv.inputMessage("Value must be between 5 and 20.");
dv.inputTitle("tip");
sheet.setDataValidator(1, 1, 1,1,dv,GC.Spread.Sheets.SheetArea.viewport);
sheet.bind(GC.Spread.Sheets.Events.ValidationError, function(e, args) {
args.validator._ps.showInputMessage = true;
});
sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
if(sheet.isValid(info.row, info.col,info.newValue)){
sheet.getCell(info.row, info.col).validator()._ps.showInputMessage = false;
}
});
|