summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph.js3
-rw-r--r--addons/web_graph/static/src/js/pivot.js18
2 files changed, 16 insertions, 5 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 94c5a4011f9..450a86a470a 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -181,7 +181,8 @@ instance.web_graph.GraphView = instance.web.View.extend({
do_search: function (domain, context, group_by) {
this.pivot_table.domain = domain;
if (group_by.length > 0) {
- this.pivot_table.set_row_groupby(group_by).done(this.proxy('display_data'));
+ this.pivot_table.set_groupby(this.pivot_table.rows, group_by)
+ .done(this.proxy('display_data'));
} else {
this.pivot_table.update_values().done(this.proxy('display_data'));
}
diff --git a/addons/web_graph/static/src/js/pivot.js b/addons/web_graph/static/src/js/pivot.js
index a9ef922819f..bca759a13e5 100644
--- a/addons/web_graph/static/src/js/pivot.js
+++ b/addons/web_graph/static/src/js/pivot.js
@@ -180,14 +180,24 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({
});
},
- set_row_groupby: function (groupby) {
+ set_groupby: function (root, groupby) {
var self = this;
- this.rows.groupby = groupby;
+ var other_root = (root === this.cols) ? this.rows : this.cols;
+
+ root.groupby = groupby;
return this.query_all_values().then(function (result) {
if (result) {
+ var new_root_headers, new_other_root_headers;
+ if (root === this.cols) {
+ new_root_headers = result.col_headers;
+ new_other_root_headers = result.how_headers;
+ } else {
+ new_root_headers = result.row_headers;
+ new_other_root_headers = result.col_headers;
+ }
self.no_data = false;
- self.expand_headers(self.rows, result.row_headers);
- self.update_headers(self.cols, result.col_headers);
+ self.expand_headers(root, new_root_headers);
+ self.update_headers(other_root, new_other_root_headers);
self.cells = result.cells;
} else {
self.no_data = true;