From dfbedd1570870786e964d3aa5fe078e0776d03b6 Mon Sep 17 00:00:00 2001 From: Jacob Boland Date: Tue, 11 Aug 2020 17:23:38 -0700 Subject: [PATCH 1/3] Move DOM binding of makeTable to the end of the method, including later binding of internal rows --- js/ui/calendar/ui.calendar.base_view.js | 2 +- js/ui/scheduler/ui.scheduler.table_creator.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/ui/calendar/ui.calendar.base_view.js b/js/ui/calendar/ui.calendar.base_view.js index 845eef41f78a..4988ca8bcfb4 100644 --- a/js/ui/calendar/ui.calendar.base_view.js +++ b/js/ui/calendar/ui.calendar.base_view.js @@ -97,6 +97,7 @@ const BaseView = Widget.inherit({ for(let colIndex = 0, colCount = this.option('colCount'); colIndex < colCount; colIndex++) { this._renderCell(rowData, colIndex); } + this.$body.get(0).appendChild(rowData.row); } }, @@ -104,7 +105,6 @@ const BaseView = Widget.inherit({ const row = domAdapter.createElement('tr'); this.setAria('role', 'row', $(row)); - this.$body.get(0).appendChild(row); return row; }, diff --git a/js/ui/scheduler/ui.scheduler.table_creator.js b/js/ui/scheduler/ui.scheduler.table_creator.js index f9173c54d496..6a47cdb5a5f7 100644 --- a/js/ui/scheduler/ui.scheduler.table_creator.js +++ b/js/ui/scheduler/ui.scheduler.table_creator.js @@ -35,8 +35,6 @@ class SchedulerTableCreator { const groupIndex = options.groupIndex; const rowCount = options.rowCount; - $(options.container).append(tableBody); - if(allDayElements) { this.insertAllDayRow(allDayElements, tableBody, 0); allDayElementIndex++; @@ -44,7 +42,6 @@ class SchedulerTableCreator { for(let i = 0; i < rowCount; i++) { row = domAdapter.createElement(ROW_SELECTOR); - tableBody.appendChild(row); const isLastRowInGroup = (i + 1) % rowCountInGroup === 0; @@ -54,7 +51,6 @@ class SchedulerTableCreator { for(let j = 0; j < options.cellCount; j++) { const td = domAdapter.createElement('td'); - row.appendChild(td); if(options.cellClass) { if(isFunction(options.cellClass)) { @@ -64,7 +60,6 @@ class SchedulerTableCreator { } } - let cellDataObject; let dataKey; let dataValue; @@ -111,14 +106,20 @@ class SchedulerTableCreator { td.innerHTML = '
' + options.getCellText(i, j) + '
'; } } + + row.appendChild(td); } if(allDayElements && isLastRowInGroup) { this.insertAllDayRow(allDayElements, tableBody, allDayElementIndex); allDayElementIndex++; } + + tableBody.appendChild(row); } + $(options.container).append(tableBody); + return templateCallbacks; } From a03ca7e2c7dc0aa538e070a2b27f0ff7ccb1528f Mon Sep 17 00:00:00 2001 From: Jacob Boland Date: Tue, 11 Aug 2020 17:59:39 -0700 Subject: [PATCH 2/3] Revert calendar changes as teh update to the dom is potentially causing a side-effect --- js/ui/calendar/ui.calendar.base_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui/calendar/ui.calendar.base_view.js b/js/ui/calendar/ui.calendar.base_view.js index 4988ca8bcfb4..845eef41f78a 100644 --- a/js/ui/calendar/ui.calendar.base_view.js +++ b/js/ui/calendar/ui.calendar.base_view.js @@ -97,7 +97,6 @@ const BaseView = Widget.inherit({ for(let colIndex = 0, colCount = this.option('colCount'); colIndex < colCount; colIndex++) { this._renderCell(rowData, colIndex); } - this.$body.get(0).appendChild(rowData.row); } }, @@ -105,6 +104,7 @@ const BaseView = Widget.inherit({ const row = domAdapter.createElement('tr'); this.setAria('role', 'row', $(row)); + this.$body.get(0).appendChild(row); return row; }, From a10b2ea44a908a9719704daac16d68635bb46a7a Mon Sep 17 00:00:00 2001 From: Jacob Boland Date: Tue, 11 Aug 2020 21:16:05 -0700 Subject: [PATCH 3/3] Move row append to above the all day row --- js/ui/scheduler/ui.scheduler.table_creator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/scheduler/ui.scheduler.table_creator.js b/js/ui/scheduler/ui.scheduler.table_creator.js index 6a47cdb5a5f7..7363eea741f1 100644 --- a/js/ui/scheduler/ui.scheduler.table_creator.js +++ b/js/ui/scheduler/ui.scheduler.table_creator.js @@ -110,12 +110,12 @@ class SchedulerTableCreator { row.appendChild(td); } + tableBody.appendChild(row); + if(allDayElements && isLastRowInGroup) { this.insertAllDayRow(allDayElements, tableBody, allDayElementIndex); allDayElementIndex++; } - - tableBody.appendChild(row); } $(options.container).append(tableBody);