diff --git a/bricks/bricks.js b/bricks/bricks.js index b010bd8..0157ffe 100755 --- a/bricks/bricks.js +++ b/bricks/bricks.js @@ -69,7 +69,13 @@ dispatch_event: params: */ -bricks.widgetBuild = async function(desc, widget){ +bricks.apply_data = function(desc, data){ + var tmpl = JSON.stringify(desc); + var s = bricks.obj_fmtstr(data, tmpl); + return JSON.parse(s); +} + +bricks.widgetBuild = async function(desc, widget, data){ if (! widget){ widget = bricks.Body; } @@ -85,6 +91,9 @@ bricks.widgetBuild = async function(desc, widget){ desc = desc1; klassname = desc.widgettype; } + if (data){ + desc = bricks.apply_data(desc, data); + } let klass = bricks.Factory.get(desc.widgettype); if (! klass){ bricks.debug('widgetBuild():',desc.widgettype, 'not registered', bricks.Factory.widgets_kw); @@ -99,7 +108,7 @@ bricks.widgetBuild = async function(desc, widget){ if (w.is_container() && desc.subwidgets){ for (let i=0; i