[minor] tree, expand on select, dont collapse

This commit is contained in:
Rushabh Mehta 2017-01-06 17:08:49 +05:30
parent 6580011f8d
commit 84baa5285d

View file

@ -33,7 +33,7 @@ frappe.ui.Tree = Class.extend({
toggle: function() {
this.get_selected_node().toggle();
}
})
});
frappe.ui.TreeNode = Class.extend({
init: function(args) {
@ -61,9 +61,6 @@ frappe.ui.TreeNode = Class.extend({
if(me.tree.toolbar) {
me.show_toolbar();
}
if(me.toggle_on_click) {
me.toggle();
}
if(me.tree.click)
me.tree.click(this);
})
@ -87,9 +84,13 @@ frappe.ui.TreeNode = Class.extend({
$(icon_html + ' <a class="tree-label grey h6">' + this.get_label() + "</a>").
appendTo(this.tree_link);
this.tree_link.find('i, a').click(function() {
this.tree_link.find('i').click(function() {
setTimeout(function() { me.toolbar.find(".btn-expand").click(); }, 100);
});
this.tree_link.find('a').click(function() {
if(!me.expanded) setTimeout(function() { me.toolbar.find(".btn-expand").click(); }, 100);
});
},
get_label: function() {
if(this.tree.get_label) {