diff -r 3084bc9ccc64 -r b415bca9a9ed web/views/treeview.py --- a/web/views/treeview.py Wed Sep 02 10:22:47 2009 +0200 +++ b/web/views/treeview.py Wed Sep 02 10:24:15 2009 +0200 @@ -32,17 +32,22 @@ if treeid is None: self.warning('Tree state won\'t be properly restored after next reload') treeid = make_uid('throw away uid') - self.w(u'') - if initial_load and not self.req.form.get('fname'): + if toplevel: self.req.add_css('jquery.treeview.css') self.req.add_js(('cubicweb.ajax.js', 'cubicweb.widgets.js', 'jquery.treeview.js')) self.req.html_headers.add_onload(u""" -jQuery("#tree-%s").treeview({toggle: toggleTree, prerendered: true});""" % treeid) - +jQuery("#tree-%s").treeview({toggle: toggleTree, prerendered: true});""" % treeid, + jsoncall=toplevel_thru_ajax) class FileTreeView(TreeView): """specific version of the treeview to display file trees @@ -91,14 +96,15 @@ (each item should be expandable if it's not a tree leaf) """ id = 'treeitemview' - __select__ = EntityView.__select__ & implements(ITree) # XXX + default_branch_state_is_open = False + __select__ = EntityView.__select__ & implements(ITree) def open_state(self, eeid, treeid): cookies = self.req.get_cookie() treestate = cookies.get(treecookiename(treeid)) if treestate: return str(eeid) in treestate.value.split(';') - return False + return self.default_branch_state_is_open def cell_call(self, row, col, treeid, vid='oneline', parentvid='treeview'): w = self.w