From 4bb3ab8a469b5dc3ad458eca1b9842baa73920a6 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 29 Oct 2015 10:49:59 +0100 Subject: [PATCH] Remove group by attribute from header. --- .../_application_controller_table.coffee | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index c53bb37eb..8ee2ac77a 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -134,23 +134,26 @@ class App.ControllerTable extends App.Controller headerFound = false for attributeName, attribute of attributes - if !attribute.style - attribute.style = {} + # remove group by attribute from header + if !@groupBy || @groupBy isnt item - if attributeName is item - # e.g. column: owner - headerFound = true - if @headerWidth[attribute.name] - attribute.width = "#{@headerWidth[attribute.name]}px" - headers.push attribute - else - # e.g. column: owner_id - rowWithoutId = item + '_id' - if attributeName is rowWithoutId + if !attribute.style + attribute.style = {} + + if attributeName is item + # e.g. column: owner headerFound = true if @headerWidth[attribute.name] attribute.width = "#{@headerWidth[attribute.name]}px" headers.push attribute + else + # e.g. column: owner_id + rowWithoutId = item + '_id' + if attributeName is rowWithoutId + headerFound = true + if @headerWidth[attribute.name] + attribute.width = "#{@headerWidth[attribute.name]}px" + headers.push attribute if @orderDirection && @orderBy for header in headers @@ -188,14 +191,6 @@ class App.ControllerTable extends App.Controller # group by if @groupBy - # remove group by attribute from header - overview = _.filter( - overview - (item) => - return item if item isnt @groupBy - return - ) - # get new order groupObjects = _.groupBy( @objects