Fix List component constructor: ensure opts.options exists before accessing width/height properties
This commit is contained in:
parent
fbd94e86a1
commit
3f449816ed
@ -3,17 +3,22 @@
|
|||||||
|
|
||||||
bricks.List = class extends bricks.VBox {
|
bricks.List = class extends bricks.VBox {
|
||||||
constructor(opts) {
|
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);
|
super(opts);
|
||||||
|
|
||||||
this.data_url = opts.data_url || null;
|
this.data_url = opts.data_url || null;
|
||||||
this.items = opts.items || [];
|
this.items = opts.items || [];
|
||||||
this.item_template_url = opts.item_template_url || null; // URL to the item template .ui file
|
this.item_template_url = opts.item_template_url || null; // URL to the item template .ui file
|
||||||
this.itemHeight = opts.itemHeight || 50;
|
this.itemHeight = opts.itemHeight || 50;
|
||||||
this._loading = false;
|
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
|
// Load data if provided
|
||||||
if (this.data_url) {
|
if (this.data_url) {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user