本帖最后由 wyq123321qyw123 于 2018-3-1 18:03 编辑
如下代码中 new GcSpread.Sheets.CellValueCondition();报未定义,是不是由于更新而变更了?
还是说如下代码是错误的?个人写的Demo中引入文件如下:
D:\Users\WANGYONGQIANG285\Desktop\引入js文件.jpg
如下代码引用论坛中 spreadjs能不能自定义验证器主题帖子中demo
window.onload = function () {
var spread = new GcSpread.Sheets.Spread(document.getElementById('ss'), { sheetCount: 1 });
// get spread object
// var spread = GcSpread.Sheets.findControl(document.getElementById('ss'));
activeSheet = spread.getActiveSheet();
var cCondition = new CustomerCondition(1, 4);
var validator1 = new GcSpread.Sheets.DefaultDataValidator(cCondition);
validator1.inputTitle = 'Please choose ';
validator1.ignoreBlank =false;
validator1.type = GcSpread.Sheets.CriteriaType.Custom;
activeSheet.setDataValidator(3,3, validator1);
spread.highlightInvalidData(true);
activeSheet.setValue(3, 3, -1);
};
function CustomerCondition(compareType, expected, formula){
var self = this;
self.ignoreBlank = false;
self.conditionType = "CustomerCondition";
self.compareType = compareType;
self.expected = expected;
self.formula = formula;
};
CustomerCondition.prototype = new GcSpread.Sheets.CellValueCondition();
CustomerCondition.prototype.evaluate = function(evaluator, baseRow, baseColumn, actualValue){
if(actualValue === this.expected){
return true;
}
else{
return false;
}
}
|