mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 07:16:52 -06:00
Fix handling of numeric arrays in View/Edit Data. Fixes #4062
This commit is contained in:
parent
3db3740cf2
commit
a4bc26c810
@ -796,7 +796,7 @@ import JSONBigNumber from 'json-bignumber';
|
||||
this.loadValue = function(item) {
|
||||
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() + '}');
|
||||
} else {
|
||||
$input.val(defaultValue);
|
||||
@ -813,23 +813,6 @@ import JSONBigNumber from 'json-bignumber';
|
||||
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;
|
||||
};
|
||||
|
||||
@ -871,7 +854,7 @@ import JSONBigNumber from 'json-bignumber';
|
||||
};
|
||||
}
|
||||
|
||||
var val = $.trim(value.slice(1, -1)),
|
||||
var val = value.trim().slice(1, -1),
|
||||
arr;
|
||||
|
||||
if (val == '') {
|
||||
|
Loading…
Reference in New Issue
Block a user