create UI tree if setting a nested propery if its undefined

This commit is contained in:
j 2015-03-23 15:23:31 +05:30
parent bf1dde53d6
commit 73c3a134a2

View file

@ -218,8 +218,14 @@ pandora.UI = (function() {
var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) { var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) {
return key.replace(/\n/g, '.') return key.replace(/\n/g, '.')
}), }),
part,
ui = pandora.user.ui; ui = pandora.user.ui;
while (keys.length > 1) { while (keys.length > 1) {
part = part ? part + '.' + keys[0] : keys[0];
if (Ox.isUndefined(ui[keys[0]])) {
ui[keys[0]] = {};
set[part] = {};
}
ui = ui[keys.shift()]; ui = ui[keys.shift()];
} }
if (!Ox.isEqual(ui[keys[0]], val)) { if (!Ox.isEqual(ui[keys[0]], val)) {