From 73c3a134a2e5d04e7cee6cce46dc3feb63a74a34 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 23 Mar 2015 15:23:31 +0530 Subject: [PATCH] create UI tree if setting a nested propery if its undefined --- static/js/UI.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/js/UI.js b/static/js/UI.js index a16ad0211..df2b7de2c 100644 --- a/static/js/UI.js +++ b/static/js/UI.js @@ -218,8 +218,14 @@ pandora.UI = (function() { var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) { return key.replace(/\n/g, '.') }), + part, ui = pandora.user.ui; 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()]; } if (!Ox.isEqual(ui[keys[0]], val)) {