From 2fd7bb315b91c900b47f798e9111aee7dea6063a Mon Sep 17 00:00:00 2001 From: Patryk Milinowski Date: Thu, 30 May 2024 14:48:24 +0100 Subject: [PATCH] mandate columns when constructing DataGrid --- source/class/qxl/datagrid/DataGrid.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/class/qxl/datagrid/DataGrid.js b/source/class/qxl/datagrid/DataGrid.js index 9d68347..d713b0f 100644 --- a/source/class/qxl/datagrid/DataGrid.js +++ b/source/class/qxl/datagrid/DataGrid.js @@ -35,6 +35,9 @@ qx.Class.define("qxl.datagrid.DataGrid", { */ construct(columns, styling) { super(); + if (!columns) { + throw new Error("Columns must be provided!"); + } this.__debounceUpdateWidgets = new qxl.datagrid.util.Debounce(() => this.updateWidgets(), 50); this.__selectionManager = new qxl.datagrid.ui.SelectionManager(); this.__selectionManager.addListener("changeSelection", evt => { @@ -42,12 +45,9 @@ qx.Class.define("qxl.datagrid.DataGrid", { this.fireDataEvent("changeSelection", evt.getData(), evt.getOldData()); }); - columns = columns || null; styling = styling || new qxl.datagrid.ui.GridStyling(); this.__sizeCalculator = new qxl.datagrid.ui.GridSizeCalculator(columns, styling, this); - if (columns) { - this.setColumns(columns); - } + this.setColumns(columns); this.getQxObject("widgetPane").addListener("modelDoubleTap", evt => this.fireDataEvent("modelDoubleTap", evt.getData()));