changeset 5fa5b8a4f73f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=5fa5b8a4f73f
description:
        Keep all records selected when clicking more

        When more is clicked, the display_size is increased and display is 
called with
        no selected value. We need to check for the selection state to include 
in the
        selected the future new rows.

        issue7712
        review60571002
diffstat:

 src/view/tree.js |  28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diffs (39 lines):

diff -r ea8b09617961 -r 5fa5b8a4f73f src/view/tree.js
--- a/src/view/tree.js  Tue Feb 26 16:05:25 2019 +0100
+++ b/src/view/tree.js  Tue Feb 26 16:07:34 2019 +0100
@@ -361,16 +361,26 @@
             var current_record = this.screen.current_record;
             if (jQuery.isEmptyObject(selected)) {
                 selected = this.get_selected_paths();
-                if (current_record) {
-                    var current_path = 
current_record.get_path(this.screen.group);
-                    current_path = current_path.map(function(e) {
-                        return e[1];
-                    });
-                    if (!Sao.common.contains(selected, current_path)) {
-                        selected = [current_path];
+                if (this.selection.prop('checked') &&
+                    !this.selection.prop('indeterminate')) {
+                    this.screen.group.slice(
+                        this.rows.length, this.display_size)
+                        .forEach(function(record) {
+                            selected.push([record.id]);
+                        });
+                } else {
+                    if (current_record) {
+                        var current_path = current_record.get_path(
+                            this.screen.group);
+                        current_path = current_path.map(function(e) {
+                            return e[1];
+                        });
+                        if (!Sao.common.contains(selected, current_path)) {
+                            selected = [current_path];
+                        }
+                    } else if (!current_record) {
+                        selected = [];
                     }
-                } else if (!current_record) {
-                    selected = [];
                 }
             }
             expanded = expanded || [];

Reply via email to