From 9eaa81f89d32f94bfb0ab6a509d59bfe617e1c66 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 3 Mar 2018 14:47:07 +0530 Subject: [PATCH] Fix cell navigation if rows are hidden --- src/cellmanager.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cellmanager.js b/src/cellmanager.js index 5b7a59c..abcbd9c 100644 --- a/src/cellmanager.js +++ b/src/cellmanager.js @@ -567,8 +567,13 @@ export default class CellManager { const { colIndex } = $.data($cell); - const $aboveRow = $cell.parentElement.previousElementSibling; + let $aboveRow = $cell.parentElement.previousElementSibling; + while ($aboveRow && $aboveRow.classList.contains('hide')) { + $aboveRow = $aboveRow.previousElementSibling; + } + + if (!$aboveRow) return $cell; return $(`[data-col-index="${colIndex}"]`, $aboveRow); } @@ -576,8 +581,13 @@ export default class CellManager { const { colIndex } = $.data($cell); - const $belowRow = $cell.parentElement.nextElementSibling; + let $belowRow = $cell.parentElement.nextElementSibling; + while ($belowRow && $belowRow.classList.contains('hide')) { + $belowRow = $belowRow.nextElementSibling; + } + + if (!$belowRow) return $cell; return $(`[data-col-index="${colIndex}"]`, $belowRow); }