[FIX] correctly calls the parent of the graph view in the constructor (now, the view...
[odoo/odoo.git] / addons / web_graph / static / src / js / graph.js
index 17a0721..9806e70 100644 (file)
@@ -18,7 +18,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
     view_type: 'graph',
 
     init: function(parent, dataset, view_id, options) {
-        this._super(parent);
+        this._super(parent, dataset, view_id, options);
         this.dataset = dataset;
         this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true});
         this.search_view = parent.searchview;
@@ -119,6 +119,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
 
         if (!this.graph_widget.enabled) {
             this.graph_widget.activate_display();
+            this.ViewManager.on('switch_mode', this, function () {this.graph_widget.pivot.update_data(); });
         }
     },
 
@@ -282,8 +283,6 @@ instance.web_graph.Graph = instance.web.Widget.extend({
         }
         if (this.pivot.no_data) {
             this.$('.graph_main_content').append($(QWeb.render('graph_no_data')));
-            // var msg = 'No data available. Try to remove any filter or add some data.';
-            // this.table.append($('<tr><td>' + msg + '</td></tr>'));
         } else {
             var table_modes = ['pivot', 'heatmap', 'row_heatmap', 'col_heatmap'];
             if (_.contains(table_modes, this.mode)) {