本帖最后由 IvanBy 于 2017-5-24 23:50 编辑
参考 http://gcdn.gcpowertools.com.cn/showtopic-23198-1-1.html的Demo,最后在setDataValidator的时候提示toJSON未定义。请问,这是什么原因呢? - var cCondition = new CustomerCondition(1, 4);
- var dv = new GcSpread.Sheets.DefaultDataValidator(cCondition);
- dv.type = GcSpread.Sheets.CriteriaType.Custom;
- function CustomerCondition(compareType, expected, formula) {
- var self = this;
- self.ignoreBlank = true;
- 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;
- }
- };
复制代码
- sheet.setDataValidator(1, 1, dv);
复制代码
|
|