From fb24de11ccaaf6c8c4ec5960a104817dc573da5c Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Wed, 17 Oct 2018 10:19:19 +0200 Subject: [PATCH] Fixed issue #2279 - performance issue in bulk action selection in overview (fixes #2279) --- .../app/controllers/_application_controller_table.coffee | 8 +++++++- .../javascripts/app/controllers/ticket_overview.coffee | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index 6240cca77..c3af532d5 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -412,6 +412,12 @@ class App.ControllerTable extends App.Controller return if !@bindCheckbox return if !@bindCheckbox.events return if _.isEmpty(clicks) + + # If a select_all callback exists, then trigger it once insteading of triggering the callback once for each checkbox + if @bindCheckbox.select_all + @bindCheckbox.select_all(clicks[0]..., e) + return + for event, callback of @bindCheckbox.events if event == 'click' || event == 'change' for click in clicks @@ -1007,4 +1013,4 @@ class App.ControllerTable extends App.Controller for position in [0..array1.length-1] if array1[position] isnt array2[position] return position - true \ No newline at end of file + true diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index bfe22a051..620362ed4 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -1175,6 +1175,7 @@ class Table extends App.Controller bindCheckbox: events: 'click': callbackCheckbox + select_all: callbackCheckbox ) @renderPopovers()