From c8fd0649189ca22bf577bcffa1eb05be5c84691f Mon Sep 17 00:00:00 2001 From: Sean McKeon Date: Wed, 14 Jan 2015 09:42:40 -0500 Subject: [PATCH 1/2] Update _Base.js In the scenario where the selection has changed directions rows are not getting unmarked. This change fixes the issue by unmarking these rows. The forceDeselect flag allows us to only execute this code in the scenario where the direction has changed. This will resolve issue #312. --- modules/extendedSelect/_Base.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/extendedSelect/_Base.js b/modules/extendedSelect/_Base.js index e422d0385..cf1c1e872 100644 --- a/modules/extendedSelect/_Base.js +++ b/modules/extendedSelect/_Base.js @@ -181,13 +181,16 @@ define([ var type = t._type, start = t._startItem, current = t._currentItem, - highlight = function(from, to, toHL){ + highlight = function(from, to, toHL, forceDeselect){ from = from[type]; to = to[type]; var dir = from < to ? 1 : -1, start = g.body.renderStart, end = start + g.body.renderCount; for(; from != to; from += dir){ + if(forceDeselect){ + t.deselectByIndex(from); + } if (from < start || from > end) continue; var item = {}; item[type] = from; @@ -204,7 +207,7 @@ define([ }else{ if(t._inRange(start[type], target[type], current[type])){ //selection has jumped to different direction, all should be deselected. - highlight(current, start, 0); //0 as false + highlight(current, start, 0, 1); //0 as false, 1 as true current = start; } highlight(target, current, 1); //1 as true From 01d0b4e50a190819d08c5142e1b081c15fb316f1 Mon Sep 17 00:00:00 2001 From: Sean McKeon Date: Wed, 27 May 2015 13:31:17 -0400 Subject: [PATCH 2/2] Update _Base.js We found a performance issue with the solution I originally proposed. This updated solution does not have the performance issue. --- modules/extendedSelect/_Base.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/extendedSelect/_Base.js b/modules/extendedSelect/_Base.js index cf1c1e872..a1c611507 100644 --- a/modules/extendedSelect/_Base.js +++ b/modules/extendedSelect/_Base.js @@ -187,15 +187,20 @@ define([ var dir = from < to ? 1 : -1, start = g.body.renderStart, end = start + g.body.renderCount; + currentIndex = from; for(; from != to; from += dir){ - if(forceDeselect){ - t.deselectByIndex(from); - } if (from < start || from > end) continue; var item = {}; item[type] = from; t._highlightSingle(item, toHL); } + if(forceDeselect){ + if(dir==1){ + t.deselectByIndex([currentIndex, from - dir]); + } else { + t.deselectByIndex([from - dir, currentIndex]); + } + } }; if(current === null){ //First time select.