From e0920173a32f7889ce2b9bc49a7a83ad035ca60a Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 28 Nov 2013 11:16:25 +0100 Subject: [REF] improves the initialization process of pivot table (addon web_graph) bzr revid: ged@openerp.com-20131128101625-7ig5lftk8wv8w6tj --- addons/web_graph/static/src/js/graph.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'addons/web_graph/static/src/js/graph.js') diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index c1c2b52f4b8..5d4eade76fb 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -114,7 +114,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.dropdown = null; } }); - return this.load_view(); }, @@ -167,7 +166,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ return $.when(important_fields_def, field_descr_def) .then(function () { self.fields = fields; - self.data = { + var data = { model: model, domain: domain, fields: fields, @@ -176,6 +175,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ row_groupby: row_groupby, groups: [], }; + self.pivot_table = new openerp.web_graph.PivotTable(data); + var measure_selection = self.$('.graph_measure_selection'); _.each(self.measure_list, function (measure) { var choice = $('').attr('data-choice', measure) @@ -188,18 +189,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, do_search: function (domain, context, group_by) { - var self = this; - this.data.domain = new instance.web.CompoundDomain(domain); - - if (!this.pivot_table) { - self.pivot_table = new openerp.web_graph.PivotTable(self.data); - self.pivot_table.start().then(self.proxy('display_data')); - } else { - this.pivot_table.domain = domain; - this.pivot_table.update_values().done(function () { - self.display_data(); - }); - } + this.pivot_table.domain = domain; + this.pivot_table.update_values().done(this.proxy('display_data')); }, do_show: function () { @@ -255,7 +246,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ dropdown_options = { header_id: options.id, fields: _.map(possible_groups, function (field) { - return {id: field, value: self.data.fields[field].string}; + return {id: field, value: self.fields[field].string}; })}; this.dropdown = $(QWeb.render('field_selection', dropdown_options)); -- cgit v1.2.3