diff --git a/wwwroot/list-component.js b/wwwroot/list-component.js index 4b51f3f..1265b85 100644 --- a/wwwroot/list-component.js +++ b/wwwroot/list-component.js @@ -3,17 +3,22 @@ bricks.List = class extends bricks.VBox { constructor(opts) { + // Ensure opts has options property + if (!opts) opts = {}; + if (!opts.options) opts.options = {}; + + // Set default dimensions if not provided + if (!opts.options.width) opts.options.width = '100%'; + if (!opts.options.height) opts.options.height = '100%'; + super(opts); + this.data_url = opts.data_url || null; this.items = opts.items || []; this.item_template_url = opts.item_template_url || null; // URL to the item template .ui file this.itemHeight = opts.itemHeight || 50; this._loading = false; - // Set default dimensions - if (!this.options.width) this.options.width = '100%'; - if (!this.options.height) this.options.height = '100%'; - // Load data if provided if (this.data_url) { this.loadData();