From 74cdc643ddf8d20eb66f7e34e1f50819c6f17f27 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 19 Apr 2020 01:35:27 +0200 Subject: [PATCH] Do not pass non persistent new records when sorting tables by removing non numeric ids --- .../javascripts/spree/backend/components/sortable_table.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/assets/javascripts/spree/backend/components/sortable_table.js b/backend/app/assets/javascripts/spree/backend/components/sortable_table.js index c67e6a673c..f696c8310c 100644 --- a/backend/app/assets/javascripts/spree/backend/components/sortable_table.js +++ b/backend/app/assets/javascripts/spree/backend/components/sortable_table.js @@ -15,7 +15,9 @@ Spree.ready(function() { var idAttr = el.id; if (idAttr) { var objId = idAttr.split('_').slice(-1); - positions['positions['+objId+']'] = index + 1; + if (!isNaN(objId)) { + positions['positions['+objId+']'] = index + 1; + } } }); Spree.ajax({