From 0f02b440d4086384af360ebdd4fc09a4d1682aba Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 14 Mar 2016 15:35:40 +0100 Subject: [PATCH] table drag and drop: keep row width --- .../app/controllers/_application_controller_table.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index 2444c798b..e1b3c8b91 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -40,6 +40,13 @@ class App.ControllerTable extends App.Controller opacity: 0.6 forcePlaceholderSize: true items: 'tr' + helper: (e, tr) -> + originals = tr.children() + helper = tr.clone() + helper.children().each (index) -> + # Set helper cell sizes to match the original sizes + $(this).width( originals.eq(index).outerWidth() ) + return helper update: @dndCallback @el.find('table > tbody').sortable(dndOptions)