summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-11-18 14:07:56 +0100
committerGery Debongnie <ged@openerp.com>2013-11-18 14:07:56 +0100
commitb34a2307cd60d857d4bcbf8cec053cf6748a8dc0 (patch)
tree2541738b974a91213494268392a3e313c8d29831 /addons/web_graph/static/src/js/graph.js
parent06b125de40269076969232fa877ea8b8ec3c61ec (diff)
[REF] moves the loading data code from start to draw function, in widget pivottable (addon web_graph)
bzr revid: ged@openerp.com-20131118130756-rx6wqcejn92j5sl4
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
-rw-r--r--addons/web_graph/static/src/js/graph.js45
1 files changed, 24 insertions, 21 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 558e101c921..a1a9ef68429 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -117,7 +117,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.data.domain = new instance.web.CompoundDomain(domain);
if (this.pivot_table) {
- this.pivot_table.draw();
+ this.pivot_table.draw(true);
} else {
this.pivot_table = new PivotTable(this.data);
this.pivot_table.appendTo('.graph_main_content');
@@ -133,7 +133,6 @@ instance.web_graph.GraphView = instance.web.View.extend({
});
-
/**
* PivotTable widget. It displays the data in tabular data and allows the
* user to drill down and up in the table
@@ -186,35 +185,39 @@ var PivotTable = instance.web.Widget.extend({
this.expand_row(row_id, field_id);
},
},
-
+
init: function (data) {
this.data = data;
},
start: function () {
- var self = this;
- this.get_groups(this.data.row_groupby)
- .then(function (groups) {
- self.data.groups = groups;
- return self.get_groups([]);
- }).then(function (total) {
- self.data.total = total;
- self.build_table();
- self.draw();
- });
+ this.draw(true);
},
- draw: function () {
+ draw: function (load_data) {
var self = this;
- this.$el.empty();
- _.each(this.headers, function (header) {
- self.$el.append(header);
- });
+ if (load_data === true) {
+ this.get_groups(this.data.row_groupby)
+ .then(function (groups) {
+ self.data.groups = groups;
+ return self.get_groups([]);
+ }).then(function (total) {
+ self.data.total = total;
+ self.build_table();
+ self.draw(false);
+ });
+ } else {
+ this.$el.empty();
- _.each(this.rows, function (row) {
- self.$el.append(row.html);
- });
+ _.each(this.headers, function (header) {
+ self.$el.append(header);
+ });
+
+ _.each(this.rows, function (row) {
+ self.$el.append(row.html);
+ });
+ }
},
show: function () {