From d0d40d7f89302d73baaf2f815bbd1e45c1d72920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 28 Apr 2023 12:56:15 +0200 Subject: [PATCH] Restore scroll position to the position before loading more rows When the scroll is at the bottom (and a footer is present), when new rows are added the scroll stay at the bottom which trigger again to load more rows. This continue until reaching the end of the tree. To prevent this behavior we restore the position of the scroll using the height from the top. Closes #12223 --- sao/src/view/tree.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index 97ff38b8c4..dfeb60541b 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -936,8 +936,17 @@ 'title': Sao.i18n.gettext("More"), }).text(Sao.i18n.gettext('More') ).click(() => { + var height = this.table.height(); this.display_size += Sao.config.display_size; this.display(); + height -= this.treeview.height(); + height -= 50; + if (this.tfoot) { + height -= this.tfoot.height(); + } + this.treeview[0].scroll({ + 'top': height, + }); }); more_cell.append(more_button); more_row.append(more_cell);