Permalink
Browse files

Open page in tree when child has been created

  • Loading branch information...
sabberworm committed Nov 13, 2012
1 parent d7e10d7 commit d93a6bb90ece210c2fb29bc293b70d44c8ce5a07
@@ -52,7 +52,7 @@ jQuery(document).ready(function() {
}
}, WidgetJSONOptions.with_callback_handles_error(false));
}, function(page_id) {
page_tree.reload_element(page_tree.element_with_identifier(page_id));
page_tree.reload_element(page_tree.element_with_identifier(page_id), true);
});
});
}, 'n', false, true, "{{writeString=wns.page.create}}");
@@ -184,23 +184,17 @@ Widget.types.tree = {
},

/**
* Reloads the children of a given element (li) as well as its properties. The item retains its open/closed state
* Reloads the children of a given element (li) as well as its properties.
* The item retains its open/closed state (except if true is passed for the `open` argument, in which case it is opened)
* @param element the element to reload
*/
reload_element: function(element) {
reload_element: function(element, open) {
this._tree.refresh(element);
// this.update_element(element);
// opener = element.children('.tree-opener');
// var sub_list = element.find(this.settings.tag_name);
// if(sub_list.length === 0 && !opener.is('.no-children')) {
// return;
// }
// sub_list.remove();
// if(opener.is('.opened') || opener.is('.no-children')) {
// opener.removeClass('opened no-children').addClass('closed');
// //Reload immediately
// this.open(element, opener);
// }
if(open) {
this._element.one('refresh.jstree', function() {
this._tree.open_node(element);
}.bind(this));
}
},

update_elements: function() {

0 comments on commit d93a6bb

Please sign in to comment.