diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-27 15:07:01 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-27 15:07:01 +0100 |
| commit | 6e88cce3fb48c9ee780bb043f7ba548eb6e98d77 (patch) | |
| tree | 870e5d79fed42357212a86113ad8c13e39351fff /addons/web_graph/static/src/js/graph.js | |
| parent | abc0bb3d87f4efd615ccaeecb95c295f64874231 (diff) | |
[FIX] display message insteal of crashing when there are no records to display (addon web_graph)
bzr revid: ged@openerp.com-20131127140701-9gej0qik7l4nzgni
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 6c1f5ae3f32..78fb16582a9 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -193,13 +193,18 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.$('.graph_main_content svg').remove(); this.table.empty(); - var table_modes = ['pivot', 'heatmap', 'row_heatmap', 'col_heatmap']; - if (_.contains(table_modes, this.mode)) { - this.draw_table(); + if (this.pivot_table.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 { - this.$('.graph_main_content').append($('<div><svg></svg></div>')); - var svg = this.$('.graph_main_content svg')[0]; - openerp.web_graph.draw_chart(this.mode, this.pivot_table, svg); + var table_modes = ['pivot', 'heatmap', 'row_heatmap', 'col_heatmap']; + if (_.contains(table_modes, this.mode)) { + this.draw_table(); + } else { + this.$('.graph_main_content').append($('<div><svg></svg></div>')); + var svg = this.$('.graph_main_content svg')[0]; + openerp.web_graph.draw_chart(this.mode, this.pivot_table, svg); + } } }, |
