use [] as default value for ArrayInput

This commit is contained in:
j 2014-12-01 17:44:07 +01:00
parent 8feaf78a8b
commit 55322cce67

View file

@ -289,7 +289,7 @@ pandora.ui.entitiesDialog = function(options) {
}, function(result) { }, function(result) {
Ox.Request.clearCache('findEntities'); Ox.Request.clearCache('findEntities');
$list.reloadList(); $list.reloadList();
pandora.UI.set('entitiesSelection.' + type, data.ids); pandora.UI.set('entitiesSelection.' + type, [result.data.id]);
}); });
} }
@ -344,7 +344,8 @@ pandora.ui.entitiesDialog = function(options) {
var keys = Ox.getObjectById(pandora.site.entities, type).keys; var keys = Ox.getObjectById(pandora.site.entities, type).keys;
$form.empty() $form.empty()
keys.forEach(function(key, index) { keys.forEach(function(key, index) {
var $label = Ox.Label({ var defaultValue = void 0,
$label = Ox.Label({
title: Ox._(key.title), title: Ox._(key.title),
width: 240 - Ox.SCROLLBAR_SIZE width: 240 - Ox.SCROLLBAR_SIZE
}) })
@ -363,6 +364,7 @@ pandora.ui.entitiesDialog = function(options) {
$input = Ox.Input(); $input = Ox.Input();
} else if (key.type[0] === 'string') { } else if (key.type[0] === 'string') {
$input = Ox.ArrayInput(); $input = Ox.ArrayInput();
defaultValue = [];
} else if (key.type === 'text') { } else if (key.type === 'text') {
$input = Ox.Input({ $input = Ox.Input({
height: 240 - Ox.SCROLLBAR_SIZE, height: 240 - Ox.SCROLLBAR_SIZE,
@ -371,7 +373,7 @@ pandora.ui.entitiesDialog = function(options) {
} }
$input.options({ $input.options({
disabled: key.id == 'id', disabled: key.id == 'id',
value: result.data[key.id], value: result.data[key.id] || defaultValue,
width: 240 - Ox.SCROLLBAR_SIZE width: 240 - Ox.SCROLLBAR_SIZE
}) })
.css({margin: '4px'}) .css({margin: '4px'})