Skip to content

Commit

Permalink
Feature/bug 44856 (#860)
Browse files Browse the repository at this point in the history
[se] Fix bug 44856
  • Loading branch information
trofim24 authored Mar 30, 2020
1 parent 04cdb01 commit 6fe1ebd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 22 additions & 2 deletions cell/model/DataValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@
}

this.type = EFormulaType.Formula;
this._formula = new AscCommonExcel.parserFormula(this.text, null, ws);
this._formula = new AscCommonExcel.parserFormula(this.text, this, ws);
this._formula.parse();
this._formula.buildDependencies();
};
CDataFormula.prototype.onFormulaEvent = function (type, eventData) {
if (AscCommon.c_oNotifyParentType.ChangeFormula === type) {
this.text = eventData.assemble;
}
};
CDataFormula.prototype.getValue = function(vt, ws, returnRaw) {
this._init(vt, ws);
if (EFormulaType.Formula === this.type) {
Expand Down Expand Up @@ -147,6 +153,14 @@
return this;
}

CDataValidation.prototype._init = function (ws) {
if (this.formula1) {
this.formula1._init(this.type, ws);
}
if (this.formula2) {
this.formula2._init(this.type, ws);
}
};
CDataValidation.prototype.clone = function() {
var res = new CDataValidation();
if (this.ranges) {
Expand Down Expand Up @@ -276,13 +290,19 @@
return this;
}

CDataValidations.prototype.init = function (ws) {
for (var i = 0; i < this.elems.length; ++i) {
this.elems[i]._init(ws);
}
};
CDataValidations.prototype.clone = function() {
var i, res = new CDataValidations();
res.disablePrompts = this.disablePrompts;
res.xWindow = this.xWindow;
res.yWindow = this.yWindow;
for (i = 0; i < this.elems.length; ++i)
for (i = 0; i < this.elems.length; ++i) {
res.elems.push(this.elems[i].clone());
}
return res;
};

Expand Down
3 changes: 3 additions & 0 deletions cell/model/Workbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -3617,6 +3617,9 @@
Worksheet.prototype.initPostOpen = function (handlers) {
this.PagePrintOptions.init();
this.headerFooter.init();
if (this.dataValidations) {
this.dataValidations.init(this);
}

// Sheet Views
if (0 === this.sheetViews.length) {
Expand Down

0 comments on commit 6fe1ebd

Please sign in to comment.