From ef714d589b6da2fe5ad1c297f2c34d84c42ec411 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 22 Oct 2015 13:24:47 +0200 Subject: [PATCH] table resize: add @minColWidth --- .../_application_controller_table.coffee | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index 46c089192..cfc8e8d73 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -1,4 +1,6 @@ class App.ControllerTable extends App.Controller + + minColWidth: 20 constructor: (params) -> for key, value of params @@ -294,6 +296,11 @@ class App.ControllerTable extends App.Controller onColResizeMousemove: (event) => # use pixels while moving for max precision difference = event.pageX - @resizeStartX + + if @resizeLeftStartWidth + difference < @minColWidth or + @resizeRightStartWidth - difference < @minColWidth + return + @resizeTargetLeft.width @resizeLeftStartWidth + difference @resizeTargetRight.width @resizeRightStartWidth - difference @@ -307,4 +314,11 @@ class App.ControllerTable extends App.Controller @resizeTargetLeft.width leftPercentage + '%' @resizeTargetRight.width rightPercentage + '%' + leftColumnKey = @resizeTargetLeft.attr('data-column-key') + rightColumnKey = @resizeTargetRight.attr('data-column-key') + # save table changed widths + # @storeColWidths [ + # { key: leftColumnKey, width: leftPercentage } + # { key: rightColumnKey, width: rightPercentage } + # ] \ No newline at end of file