Permalink
Browse files

Bug fix about multiple repeaters calculation.

  • Loading branch information...
Masayuki Nii
Masayuki Nii committed Jan 27, 2018
1 parent 8c5dfb1 commit 99fbf43b11a9ee9af09fa9f602702309aa4733c5
Showing with 21 additions and 11 deletions.
  1. +15 −8 INTER-Mediator-Calc.js
  2. +3 −0 INTER-Mediator-Lib.js
  3. +2 −2 INTER-Mediator-Page.js
  4. +1 −1 metadata.json
@@ -254,7 +254,6 @@ var IMLibCalc = {
}
}
if (newValueAdded) {
//console.log('calc-test', calcObject.expression, calcObject.values);
updatedValue = Parser.evaluate(
calcObject.expression,
calcObject.values
@@ -278,7 +277,8 @@ var IMLibCalc = {
*/
setUndefinedToAllValues: function () {
'use strict';
var nodeId, calcObject, ix, targetNode, field, targetExp, targetIds, isRemoved, idValue, repeaterTop;
var nodeId, calcObject, ix, targetNode, field, targetExp, targetIds,
isRemoved, idValue, repeaterTop, checkRepeater, nodeInfo, linkInfos;
do {
isRemoved = false;
@@ -295,14 +295,21 @@ var IMLibCalc = {
for (nodeId in IMLibCalc.calculateRequiredObject) {
calcObject = IMLibCalc.calculateRequiredObject[nodeId];
targetNode = document.getElementById(nodeId);
idValue = nodeId.match(IMLibCalc.regexpForSeparator) ?
nodeId.split(IMLibCalc.regexpForSeparator)[0] : nodeId;
targetNode = document.getElementById(idValue);
linkInfos = INTERMediatorLib.getLinkedElementInfo(targetNode);
if(INTERMediatorLib.is_array(linkInfos)){
linkInfos = linkInfos[0];
}
nodeInfo = INTERMediatorLib.getNodeInfoArray(linkInfos);
for (field in calcObject.values) {
if (field.indexOf(INTERMediator.separator) > -1) {
targetExp = field;
} else {
targetExp = calcObject.nodeInfo.table + INTERMediator.separator + field;
}
if (nodeId.nodeInfo && nodeId.nodeInfo.crossTable) {
if (nodeInfo && nodeInfo.crossTable) {
repeaterTop = targetNode;
while (repeaterTop.tagName != 'TD' && repeaterTop.tagName != 'TH') {
repeaterTop = repeaterTop.parentNode;
@@ -312,8 +319,8 @@ var IMLibCalc = {
if (targetIds && targetIds.length > 0) {
break;
}
targetNode = getParentRepeater(INTERMediatorLib.getParentEnclosure(targetNode));
} while (targetNode);
checkRepeater = getParentRepeater(INTERMediatorLib.getParentEnclosure(targetNode));
} while (checkRepeater);
} else {
do {
targetIds = INTERMediatorOnPage.getNodeIdsHavingTargetFromRepeater(targetNode, targetExp);
@@ -324,8 +331,8 @@ var IMLibCalc = {
if (targetIds && targetIds.length > 0) {
break;
}
targetNode = getParentRepeater(INTERMediatorLib.getParentEnclosure(targetNode));
} while (targetNode);
checkRepeater = getParentRepeater(INTERMediatorLib.getParentEnclosure(targetNode));
} while (checkRepeater);
}
if (INTERMediatorLib.is_array(targetIds) && targetIds.length > 0) {
calcObject.referes[field] = [];
@@ -132,6 +132,9 @@ var INTERMediatorLib = {
var result = [];
var i, target = '';
var linkInfo = INTERMediatorLib.getLinkedElementInfo(node);
if (!linkInfo){
return null;
}
var linkComp = linkInfo[0].split('@');
if (linkComp.length>2){
target = linkComp[2];
@@ -930,11 +930,11 @@ var INTERMediatorOnPage = {
for (i = 0; i < enclosureNode.length; i += 1) {
if (enclosureNode[i] !== null) {
if (Array.isArray(enclosureNode[i])) {
for (j = 0; j < enclosureNode.length; j++) {
for (j = 0; j < enclosureNode[i].length; j++) {
seekNode(enclosureNode[i][j], imDefinition);
}
} else {
seekNode(enclosureNode, imDefinition);
seekNode(enclosureNode[i], imDefinition);
}
}
}
@@ -1 +1 @@
{"version":"5.7-dev","releasedate":"2018-01-24"}
{"version":"5.7-dev","releasedate":"2018-01-27"}

0 comments on commit 99fbf43

Please sign in to comment.