fix: refresh tree when the treeview is loaded
This commit is contained in:
parent
cc15cc73eb
commit
fb0bc3bdcd
1 changed files with 13 additions and 0 deletions
|
|
@ -21,6 +21,19 @@ frappe.views.TreeFactory = class TreeFactory extends frappe.views.Factory {
|
|||
frappe.views.trees[options.doctype] = new frappe.views.TreeView(options);
|
||||
});
|
||||
}
|
||||
|
||||
on_show() {
|
||||
/**
|
||||
* When the the treeview is visited using the previous button,
|
||||
* the framework just show the treeview element that is hidden.
|
||||
* Due to this, the data of the tree can be old.
|
||||
* To deal with this, the tree will be refreshed whenever the
|
||||
* treeview is visible.
|
||||
*/
|
||||
let route = frappe.get_route();
|
||||
let treeview = frappe.views.trees[route[1]];
|
||||
treeview && treeview.make_tree();
|
||||
}
|
||||
}
|
||||
|
||||
frappe.views.TreeView = class TreeView {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue