From a0b22b61abc7a236fd92c349ee318f6cb9690f7c Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Tue, 7 Jul 2026 09:45:39 -0700 Subject: [PATCH] Fix TypeError when toggling edit mode before Data Views grid loads onEnableEditMode/onDisableEditMode called _getEditColumn().show()/.hide() without checking that the column exists, but the column is only created once the grid's async configuration request completes; enableEdit() invoked from an Ext.onReady handler on page load can win that race and throw before the grid is ready. Guard both calls with a null check, and source the edit column's initial hidden state from editMode instead of the constructor-time manageView snapshot so visibility stays correct once the column is created after a mode toggle. --- query/webapp/dataview/DataViewsPanel.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/query/webapp/dataview/DataViewsPanel.js b/query/webapp/dataview/DataViewsPanel.js index 8d8ae2de469..08a969a5d87 100644 --- a/query/webapp/dataview/DataViewsPanel.js +++ b/query/webapp/dataview/DataViewsPanel.js @@ -705,7 +705,7 @@ Ext4.define('LABKEY.ext4.DataViewsPanel', { }, scope : this }, - hidden : !this.manageView, + hidden : !this.editMode, scope : this },{ xtype : 'fatreecolumn', @@ -1050,14 +1050,20 @@ Ext4.define('LABKEY.ext4.DataViewsPanel', { onEnableEditMode : function() { this.editMode = true; - this._getEditColumn().show(); + var editColumn = this._getEditColumn(); + if (editColumn) { + editColumn.show(); + } this.refreshViewStore(); this.applySearchFilter(); }, onDisableEditMode : function() { this.editMode = false; - this._getEditColumn().hide(); + var editColumn = this._getEditColumn(); + if (editColumn) { + editColumn.hide(); + } this.refreshViewStore(); this.applySearchFilter(); },