summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-11-28 11:16:25 +0100
committerGery Debongnie <ged@openerp.com>2013-11-28 11:16:25 +0100
commite0920173a32f7889ce2b9bc49a7a83ad035ca60a (patch)
tree17b0ac8916dcd0dbd99d7057831f53f52007a37f /addons/web_graph/static/src/js
parent4aa70638ef8418f18e05bd8ff7dba88724b886a6 (diff)
[REF] improves the initialization process of pivot table (addon web_graph)
bzr revid: ged@openerp.com-20131128101625-7ig5lftk8wv8w6tj
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph.js21
-rw-r--r--addons/web_graph/static/src/js/pivot.js3
2 files changed, 9 insertions, 15 deletions
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 = $('<a></a>').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));
diff --git a/addons/web_graph/static/src/js/pivot.js b/addons/web_graph/static/src/js/pivot.js
index 68c5ca43a3e..80e5e95306b 100644
--- a/addons/web_graph/static/src/js/pivot.js
+++ b/addons/web_graph/static/src/js/pivot.js
@@ -194,6 +194,9 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({
},
update_values: function () {
+ if (!this.rows.headers) {
+ return this.expand_all();
+ }
var self = this;
return this.query_all_values().then(function (result) {
if (!result) {