diff --git a/bricks/dynamiccolumn.js b/bricks/dynamiccolumn.js index 569ecfa..e0a07b5 100644 --- a/bricks/dynamiccolumn.js +++ b/bricks/dynamiccolumn.js @@ -15,22 +15,34 @@ bricks.DynamicColumn = class extends bricks.Layout { opts.col_cwidth = 20; } } - opts.col_cgap = opts.col_cgap || 0.5; + opts.col_cgap = opts.col_cgap || 1; opts.mobile_cols = opts.mobile_cols|| 1; super(opts); this.set_style('display', 'grid'); - // this.set_column_width(); + this.set_style('align-items', 'start'); this.bind('on_parent', this.set_column_width.bind(this)); this.bind('resize', this.set_column_width.bind(this)); if (this.cwidth){ bricks.app.bind('charsize', this.set_column_width.bind(this)); } + // Watch for new children added and fix their width + this._observer = new MutationObserver(this._fix_children.bind(this)); + this._observer.observe(this.dom_element, {childList: true, subtree: false}); + } + _fix_children(){ + var children = this.dom_element.children; + for (var i=0; i