Skip to content

Commit

Permalink
Merge pull request jsonform#239 from thanhngch/feature/drag_drop_temp…
Browse files Browse the repository at this point in the history
…late_value

Drag drop will update template {{values}} data
  • Loading branch information
tchapi authored Jun 19, 2019
2 parents 1042794 + e125a75 commit e09d333
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/jsonform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2153,9 +2153,16 @@ formNode.prototype.computeInitialValues = function (values, ignoreDefaultValues)

// Prepare special function to compute the value of another field
formData.getValue = function (key) {
return getInitialValue(self.ownerTree.formDesc,
key, self.arrayPath,
formData, !!values);
if (!values) {
return '';
}
var returnValue = values;
var listKey = key.split('[].');
var i;
for (i = 0; i < listKey.length - 1; i++) {
returnValue = returnValue[listKey[i]][self.arrayPath[i]];
}
return returnValue[listKey[i]];
};

if (this.formElement) {
Expand Down

0 comments on commit e09d333

Please sign in to comment.