[IMP] add redraw flag to basicview widget in addon web_graph

bzr revid: ged@openerp.com-20131113092646-182veoj027lkbdb6
This commit is contained in:
Gery Debongnie 2013-11-13 10:26:46 +01:00
parent 3c0445479b
commit 3be25d2c45
1 changed files with 9 additions and 2 deletions

View File

@ -74,7 +74,6 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.pivot_table.show();
} else {
this.pivot_table.hide();
this.chart_view.draw();
this.chart_view.show();
}
},
@ -85,7 +84,6 @@ instance.web_graph.GraphView = instance.web.View.extend({
return this.get_data().done(function (data) {
self.pivot_table.set_data(data);
self.chart_view.set_data(data);
self.pivot_table.draw();
self.display_data();
});
},
@ -103,6 +101,9 @@ instance.web_graph.GraphView = instance.web.View.extend({
* and ChartView widget.
*/
var BasicDataView = instance.web.Widget.extend({
need_redraw: false,
init: function (fields, groupby, measure) {
this.fields = fields;
this.groupby = groupby;
@ -113,9 +114,14 @@ var BasicDataView = instance.web.Widget.extend({
set_data : function (data) {
this.data = data;
this.need_redraw = true;
},
show: function () {
if (this.need_redraw) {
this.draw();
this.need_redraw = false;
}
this.$el.css('display', 'block');
},
@ -170,6 +176,7 @@ var ChartView = BasicDataView.extend({
};
this.render = render_functions[mode];
this.need_redraw = true;
},
draw: function () {