Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
190b89ea by Cédric Krier at 2023-04-28T12:52:09+02:00
Count optional column as visible if the tree is not traggable
- - - - -
0172717f by Cédric Krier at 2023-04-28T12:53:04+02:00
Do not add multiple times a more row
- - - - -
6bcec872 by Cédric Krier at 2023-04-28T12:56:15+02:00
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
- - - - -


1 changed file:

- sao/src/view/tree.js


Changes:

=====================================
sao/src/view/tree.js
=====================================
@@ -794,6 +794,9 @@
 
             // Set column visibility depending on attributes and domain
             var visible_columns = 1;  // start at 1 because of the checkbox
+            if (this.optionals.length && !this.draggable) {
+                visible_columns += 1;
+            }
             var domain = [];
             if (!jQuery.isEmptyObject(this.screen.domain)) {
                 domain.push(this.screen.domain);
@@ -919,7 +922,8 @@
                 }).map(function(row) {
                     return row.el;
                 }));
-                if (this.display_size < this.group.length) {
+                if ((this.display_size < this.group.length) &&
+                    (!this.tbody.children().last().hasClass('more-row'))) {
                     var more_row = jQuery('<tr/>', {
                         'class': 'more-row',
                     });
@@ -932,5 +936,6 @@
                         '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();
@@ -935,5 +940,13 @@
                         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);



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/b9dd379ea9d7c706d1cfddbf3e3eed0c74222d5a...6bcec872fdb13b1f3222c0a08757b44c5877d79c

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/b9dd379ea9d7c706d1cfddbf3e3eed0c74222d5a...6bcec872fdb13b1f3222c0a08757b44c5877d79c
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to