diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index 6db5b370b..76d1c6f7f 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -100,9 +100,6 @@ class App.ControllerTable extends App.Controller destroyColWidth: 70 cloneColWidth: 70 - elements: - '.js-tableHead': 'tableHead' - events: 'click .js-sort': 'sortByColumn' @@ -167,9 +164,10 @@ class App.ControllerTable extends App.Controller for key, value of data.headerWidth @headerWidth[key] = value - @availableWidth = @el.width() - if @availableWidth is 0 - @availableWidth = @minTableWidth + if !@availableWidth + @availableWidth = @el.width() + if @availableWidth is 0 + @availableWidth = @minTableWidth @renderQueue() @@ -837,7 +835,7 @@ class App.ControllerTable extends App.Controller roundingLeftOver = availableWidth - @getHeaderWidths() # but only if there is something left over (will get negative when there are too many columns for each column to stay in their min width) - if roundingLeftOver > 0 + if roundingLeftOver > 0 && roundingLeftOver < 10 @headers[@headers.length - 1].displayWidth = @headers[@headers.length - 1].displayWidth + roundingLeftOver @storeHeaderWidths() @@ -872,7 +870,7 @@ class App.ControllerTable extends App.Controller setHeaderWidths: => @calculateHeaderWidths() - @tableHead.each (i, el) => + @$('.js-tableHead').each (i, el) => el.style.width = @headers[i].displayWidth + 'px' storeHeaderWidths: -> @@ -885,7 +883,13 @@ class App.ControllerTable extends App.Controller onResize: => @availableWidth = @el.width() - @setHeaderWidths() + localDelay = => + localSetHeaderWidths = => + @setHeaderWidths() + App.QueueManager.add('tableRender', localSetHeaderWidths) + App.QueueManager.run('tableRender') + + @delay(localDelay, 200, 'table-resize-finish') stopPropagation: (event) -> event.stopPropagation() diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 3c186591c..8da834f17 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -1181,7 +1181,7 @@ class Table extends App.Controller if @el.width() != 0 @elWidth = @el.width() if @elWidth - tableArguments.minTableWidth = @elWidth + tableArguments.availableWidth = @elWidth @table = new App.ControllerTable(tableArguments)