Skip to content

Fix TypeError when toggling edit mode before Data Views grid loads#7819

Merged
labkey-tchad merged 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_dataViewsPanelRaceFix
Jul 7, 2026
Merged

Fix TypeError when toggling edit mode before Data Views grid loads#7819
labkey-tchad merged 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_dataViewsPanelRaceFix

Conversation

@labkey-tchad

@labkey-tchad labkey-tchad commented Jul 7, 2026

Copy link
Copy Markdown
Member

Rationale

Toggling "Edit" on the Data Views webpart before its grid finishes its async configuration load throws TypeError: can't access property "show", this._getEditColumn() is undefined, because onEnableEditMode/onDisableEditMode call .show()/.hide() on the edit column before it exists. This happens in practice when a page (e.g. project-begin.view) calls enableEdit() from an Ext.onReady handler, which reliably wins the race against the panel's own config request.

Prompted by this error on TeamCity:

TypeError: can't access property "show", this._getEditColumn() is undefined
  onEnableEditMode (http://localhost:8111/labkey/dataview/DataViewsPanel.js:1053:14)
  fire (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:9824:49)
  continueFireEvent (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:11215:47)
  fireEventArgs (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:11193:26)
  monitor/prototype.fireEventArgs (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:41550:37)
  fireEvent (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:11179:25)
  edit (http://localhost:8111/labkey/dataview/DataViewsPanel.js:1047:18)
  enableEdit (http://localhost:8111/labkey/StudyVerifyProject/My%20Study%20Data%20Views/project-begin.view:470:32)
  createSingle/< (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:9869:28)
  fire (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:9824:49)
  Ext.EventManager</readyEvent.fire (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:10058:52)
  fireReadyEvent (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:10136:28)
  onDocumentReady (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:10154:34)
  fn (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:6664:25)
  onReady (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:6669:20)
  Ext.EventManager</Ext.onReady (http://localhost:8111/labkey/ext-4.2.1/ext-all-sandbox-debug.js:10934:20)
  editDataViews (http://localhost:8111/labkey/StudyVerifyProject/My%20Study%20Data%20Views/project-begin.view:473:14)
  h10 (http://localhost:8111/labkey/StudyVerifyProject/My%20Study%20Data%20Views/project-begin.view:1268:14)

Related Pull Requests

None.

Changes

  • Null-guard the edit column lookup in onEnableEditMode/onDisableEditMode before calling .show()/.hide().
  • Source the edit column's initial hidden state from this.editMode instead of the constructor-time this.manageView snapshot, so the column renders with the correct visibility once it's created after a mode toggle occurred first.

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.
@labkey-tchad labkey-tchad self-assigned this Jul 7, 2026

@labkey-klum labkey-klum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@labkey-gokhano labkey-gokhano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the code changes with Claude assist, all looking good.

@labkey-tchad labkey-tchad merged commit 685da1b into release26.7-SNAPSHOT Jul 7, 2026
7 of 8 checks passed
@labkey-tchad labkey-tchad deleted the 26.7_fb_dataViewsPanelRaceFix branch July 7, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants