changeset 69f1a41b8948 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=69f1a41b8948
description:
        Do not toggle row on click if it has more children than the limit

        This allows to trigger the tree_open action instead of switching to 
form on
        double click.

        issue8673
        review276031002
diffstat:

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

diffs (32 lines):

diff -r 9953ba78be72 -r 69f1a41b8948 src/view/tree.js
--- a/src/view/tree.js  Sat Sep 28 23:23:01 2019 +0200
+++ b/src/view/tree.js  Sun Sep 29 23:40:55 2019 +0200
@@ -1148,6 +1148,14 @@
             this.selection.change(this.selection_changed.bind(this));
             td.append(this.selection);
 
+            var on_click = function(event_) {
+                if (this.expander && !this.is_expanded() &&
+                    (this.tree.n_children(this) <= Sao.config.limit)) {
+                    this.toggle_row();
+                }
+                this.select_column(event_.data.index);
+            }.bind(this);
+
             for (var i = 0; i < this.tree.columns.length; i++) {
                 var column = this.tree.columns[i];
                 td = jQuery('<td/>', {
@@ -1155,12 +1163,7 @@
                 }).append(jQuery('<span/>', { // For responsive min-height
                     'aria-hidden': true
                 }));
-                td.on('click keypress', {'index': i}, function(event_) {
-                    if (this.expander && !this.is_expanded()) {
-                        this.toggle_row();
-                    }
-                    this.select_column(event_.data.index);
-                }.bind(this));
+                td.on('click keypress', {'index': i}, on_click);
                 if (!this.tree.editable) {
                     td.dblclick(this.switch_row.bind(this));
                 } else {

Reply via email to