From a3f3aab2a08ee04e581ed1d9b35d19a8704aeef9 Mon Sep 17 00:00:00 2001 From: artdeoich Date: Thu, 26 Sep 2019 09:56:17 +0200 Subject: [PATCH 1/3] keep scroll position of selects after moving --- src/jquery.bootstrap-duallistbox.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/jquery.bootstrap-duallistbox.js b/src/jquery.bootstrap-duallistbox.js index 46dd48d..417cc41 100644 --- a/src/jquery.bootstrap-duallistbox.js +++ b/src/jquery.bootstrap-duallistbox.js @@ -120,6 +120,9 @@ function refreshSelects(dualListbox) { dualListbox.selectedElements = 0; + var initialScrollPositionSelect1 = dualListbox.elements.select1.scrollTop(); + var initialScrollPositionSelect2 = dualListbox.elements.select2.scrollTop(); + dualListbox.elements.select1.empty(); dualListbox.elements.select2.empty(); @@ -137,6 +140,10 @@ filter(dualListbox, 1); filter(dualListbox, 2); } + + dualListbox.elements.select1.scrollTop(initialScrollPositionSelect1); + dualListbox.elements.select2.scrollTop(initialScrollPositionSelect2); + refreshInfo(dualListbox); } From 4a1d19d3e3835c047aa0a3cf646d9161e04bff92 Mon Sep 17 00:00:00 2001 From: artdeoich Date: Thu, 26 Sep 2019 10:14:31 +0200 Subject: [PATCH 2/3] Update jquery.bootstrap-duallistbox.js --- src/jquery.bootstrap-duallistbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.bootstrap-duallistbox.js b/src/jquery.bootstrap-duallistbox.js index 417cc41..9aa4b16 100644 --- a/src/jquery.bootstrap-duallistbox.js +++ b/src/jquery.bootstrap-duallistbox.js @@ -120,8 +120,8 @@ function refreshSelects(dualListbox) { dualListbox.selectedElements = 0; - var initialScrollPositionSelect1 = dualListbox.elements.select1.scrollTop(); - var initialScrollPositionSelect2 = dualListbox.elements.select2.scrollTop(); + const initialScrollPositionSelect1 = dualListbox.elements.select1.scrollTop(); + const initialScrollPositionSelect2 = dualListbox.elements.select2.scrollTop(); dualListbox.elements.select1.empty(); dualListbox.elements.select2.empty(); From 08359ca465e4037f9e3f8a8ff76f31683cae0e23 Mon Sep 17 00:00:00 2001 From: artdeoich Date: Thu, 26 Sep 2019 10:18:35 +0200 Subject: [PATCH 3/3] Update jquery.bootstrap-duallistbox.js --- src/jquery.bootstrap-duallistbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.bootstrap-duallistbox.js b/src/jquery.bootstrap-duallistbox.js index 9aa4b16..417cc41 100644 --- a/src/jquery.bootstrap-duallistbox.js +++ b/src/jquery.bootstrap-duallistbox.js @@ -120,8 +120,8 @@ function refreshSelects(dualListbox) { dualListbox.selectedElements = 0; - const initialScrollPositionSelect1 = dualListbox.elements.select1.scrollTop(); - const initialScrollPositionSelect2 = dualListbox.elements.select2.scrollTop(); + var initialScrollPositionSelect1 = dualListbox.elements.select1.scrollTop(); + var initialScrollPositionSelect2 = dualListbox.elements.select2.scrollTop(); dualListbox.elements.select1.empty(); dualListbox.elements.select2.empty();