Fix handling of numeric arrays in View/Edit Data. Fixes #4062

This commit is contained in:
Aditya Toshniwal 2019-03-19 16:45:00 +00:00 committed by Dave Page
parent 3db3740cf2
commit a4bc26c810

View File

@ -796,7 +796,7 @@ import JSONBigNumber from 'json-bignumber';
this.loadValue = function(item) { this.loadValue = function(item) {
defaultValue = item[args.column.field]; defaultValue = item[args.column.field];
if (args.column.is_array && !_.isNull(defaultValue) && !_.isUndefined(defaultValue)) { if (Array.isArray(defaultValue) && !_.isNull(defaultValue) && !_.isUndefined(defaultValue)) {
$input.val('{' + defaultValue.join() + '}'); $input.val('{' + defaultValue.join() + '}');
} else { } else {
$input.val(defaultValue); $input.val(defaultValue);
@ -813,23 +813,6 @@ import JSONBigNumber from 'json-bignumber';
return null; return null;
} }
if (args.column.is_array) {
// Remove leading { and trailing }.
// Also remove leading and trailing whitespaces.
var val = $.trim(value.slice(1, -1));
if (val == '') {
return [];
}
val = val.split(',');
for (var k in val) {
if (val[k] == '') {
val[k] = null; //empty string from editor is null value.
}
}
return val;
}
return value; return value;
}; };
@ -871,7 +854,7 @@ import JSONBigNumber from 'json-bignumber';
}; };
} }
var val = $.trim(value.slice(1, -1)), var val = value.trim().slice(1, -1),
arr; arr;
if (val == '') { if (val == '') {