changeset 51003ba5a1b4 in sao:5.2
details: https://hg.tryton.org/sao?cmd=changeset;node=51003ba5a1b4
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 119921ae2ec8 -r 51003ba5a1b4 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
@@ -890,6 +890,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/>', {
@@ -897,12 +905,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 {