From e483027956fcbe07fef71a4edb04d96b80ebc5dc Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 9 Aug 2011 12:04:38 +0200 Subject: [PATCH] [IMP] simplify and cleanup handling of clicking on a given table open/close icon; split out setup in a separate method bind the event *once* at the table toplevel instead of binding it at every sub-tree display, which mandates adding supplementary code to filter out clicks coming from the wrong height of the tree and not concerning the record(s) we're interested in bzr revid: xmo@openerp.com-20110809100438-i9546bkxydaz58ol --- addons/base/static/src/js/tree.js | 69 ++++++++++++++++------------- addons/base/static/src/xml/base.xml | 1 + 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/addons/base/static/src/js/tree.js b/addons/base/static/src/js/tree.js index acb588366a1..ef4d03b34f1 100644 --- a/addons/base/static/src/js/tree.js +++ b/addons/base/static/src/js/tree.js @@ -18,7 +18,8 @@ openerp.base.TreeView = openerp.base.View.extend({ this.model = dataset.model; this.view_id = view_id; this.session = session; - this.columns = []; + + this.records = {}; this.options = _.extend({}, this.defaults, options || {}); @@ -78,6 +79,7 @@ openerp.base.TreeView = openerp.base.View.extend({ self.getdata($option.val(), $option.data('children')); }); _(records).each(function (record) { + self.records[record.id] = record; $('