changeset fcffddce1056 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=fcffddce1056
description:
        Use length on Sao.Group to display or not expander

        issue8638
        review284031002
        (grafted from c0b0c3aec09d6dc28d120a289450036711f330a3)
diffstat:

 src/view/tree.js |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (27 lines):

diff -r 2c6ddee0025a -r fcffddce1056 src/view/tree.js
--- a/src/view/tree.js  Sat Sep 07 23:27:37 2019 +0200
+++ b/src/view/tree.js  Mon Sep 23 23:22:17 2019 +0200
@@ -1028,18 +1028,16 @@
             this.set_selection(Sao.common.contains(selected, row_id_path));
             if (this.children_field) {
                 this.record.load(this.children_field).done(function() {
-                    var children = this.record.field_get_client(
-                        this.children_field);
-                    if (this.is_expanded() ||
-                        Sao.common.contains(expanded, row_id_path) &&
-                        !jQuery.isEmptyObject(children)) {
+                    var length = this.record.field_get_client(
+                        this.children_field).length;
+                    if (length && (
+                        this.is_expanded() ||
+                        Sao.common.contains(expanded, row_id_path))) {
                         this.expander.css('visibility', 'visible');
                         this.tree.expanded[this.path] = this;
                         this.expand_children(selected, expanded);
                         this.update_expander(true);
                     } else {
-                        var length = this.record.field_get_client(
-                            this.children_field).length;
                         this.expander.css('visibility',
                             length ? 'visible' : 'hidden');
                         this.update_expander(false);

Reply via email to