[IMP] many very small tweaks to pivot view (addon web_graph)
bzr revid: ged@openerp.com-20131124142927-jnuqykwfp351337v
This commit is contained in:
parent
616af47ff7
commit
aa5958eaf5
|
@ -1,4 +1,8 @@
|
|||
|
||||
function draw_chart (svg, mode, pivot) {
|
||||
Charts[mode](pivot);
|
||||
}
|
||||
|
||||
function format_chart_data (pivot) {
|
||||
var values = _.map(pivot.rows.headers[0].children.reverse(), function (pt) {
|
||||
var val = pivot.get_value(pt.id, 2);
|
||||
|
|
|
@ -63,8 +63,18 @@ instance.web_graph.GraphView = instance.web.View.extend({
|
|||
this.draw_table();
|
||||
},
|
||||
|
||||
'click label.graph_clear_all' : function (event) {
|
||||
this.pivot_table.clear_all();
|
||||
'click label.graph_fold_all' : function (event) {
|
||||
this.pivot_table.fold_all();
|
||||
this.draw_table();
|
||||
},
|
||||
|
||||
'click label.graph_fold_rows' : function (event) {
|
||||
this.pivot_table.fold_rows();
|
||||
this.draw_table();
|
||||
},
|
||||
|
||||
'click label.graph_fold_cols' : function (event) {
|
||||
this.pivot_table.fold_cols();
|
||||
this.draw_table();
|
||||
},
|
||||
},
|
||||
|
@ -172,7 +182,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
|
|||
this.svg.remove();
|
||||
this.svg = $('<div><svg></svg></div>');
|
||||
this.$el.filter('.graph_main_content').append(this.svg);
|
||||
Charts[mode](this.pivot_table);
|
||||
draw_chart(this.svg, mode, this.pivot_table);
|
||||
|
||||
}
|
||||
},
|
||||
|
|
|
@ -154,7 +154,7 @@ var PivotTable = openerp.web.Class.extend({
|
|||
children: [],
|
||||
domain: groups[0].model._domain,
|
||||
};
|
||||
parent.children.push(new_header);
|
||||
parent.children.splice(0,0, new_header)
|
||||
insertAfter(header_list, parent, new_header);
|
||||
return new_header.id;
|
||||
},
|
||||
|
@ -169,7 +169,7 @@ var PivotTable = openerp.web.Class.extend({
|
|||
|
||||
return query_groups_data(this.model, this.visible_fields(), col.domain, this.rows.groupby, field_id)
|
||||
.then(function (groups) {
|
||||
_.each(groups, function (group) {
|
||||
_.each(groups.reverse(), function (group) {
|
||||
var new_col_id = self.make_header(group, col, self.cols.headers);
|
||||
_.each(group, function (data) {
|
||||
var row = _.find(self.rows.headers, function (c) {
|
||||
|
@ -188,6 +188,8 @@ var PivotTable = openerp.web.Class.extend({
|
|||
var temp = this.rows;
|
||||
this.rows = this.cols;
|
||||
this.cols = temp;
|
||||
this.rows.main.name = "Total";
|
||||
this.cols.main.name = this.measure_label;
|
||||
|
||||
_.each(this.cells, function (cell) {
|
||||
temp = cell.row_id;
|
||||
|
@ -196,10 +198,19 @@ var PivotTable = openerp.web.Class.extend({
|
|||
});
|
||||
},
|
||||
|
||||
clear_all: function () {
|
||||
fold_rows: function () {
|
||||
this.fold_row(this.rows.main);
|
||||
},
|
||||
|
||||
fold_cols: function () {
|
||||
this.fold_col(this.cols.main);
|
||||
}
|
||||
},
|
||||
|
||||
fold_all: function () {
|
||||
this.fold_rows();
|
||||
this.fold_cols();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
<li><a data-mode="pie_chart" href="#">Pie chart</a></li>
|
||||
</ul>
|
||||
<label type="button" class="btn btn-default graph_swap_axis">Swap axis</label>
|
||||
<label type="button" class="btn btn-default graph_clear_all">Clear all groups</label>
|
||||
<label type="button" class="btn btn-default graph_fold_rows">Fold rows</label>
|
||||
<label type="button" class="btn btn-default graph_fold_cols">Fold cols</label>
|
||||
<label type="button" class="btn btn-default graph_fold_all">Fold all</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="graph_main_content"></div>
|
||||
|
|
Loading…
Reference in New Issue