changeset f94469d7f108 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=f94469d7f108
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
        (grafted from 69f1a41b89489557d3378c3c7b26a9841c011491)
diffstat:

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

diffs (32 lines):

diff -r 7d60dccb7f5a -r f94469d7f108 src/view/tree.js
--- a/src/view/tree.js  Sun Oct 06 13:52:16 2019 +0200
+++ b/src/view/tree.js  Sun Sep 29 23:40:55 2019 +0200
@@ -881,6 +881,14 @@
             td.append(this.selection);
 
             var depth = this.path.split('.').length;
+            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/>', {
@@ -888,12 +896,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