summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-11-24 21:58:55 +0100
committerGery Debongnie <ged@openerp.com>2013-11-24 21:58:55 +0100
commit5227f89396de7527906e7708d3559cc6576cabfe (patch)
tree1da59e1f2e3fe464d0a544fc411b9627a169fd78 /addons/web_graph/static/src/js/graph.js
parent46ea9d29feb8d46eb5ee4d1900c955a219fca907 (diff)
[REF] merge expand_row and expand_col methods into the fold method, also some small code tweaks (addon web_graph)
bzr revid: ged@openerp.com-20131124205855-eekx2gwhgl4ye9uj
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
-rw-r--r--addons/web_graph/static/src/js/graph.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 0a1dcdd001b..0ab02ccb51b 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -48,12 +48,12 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.dropdown.remove();
if (event.target.attributes['data-row-id'] !== undefined) {
id = event.target.attributes['data-row-id'].nodeValue;
- this.pivot_table.expand_row(id, field_id)
+ this.pivot_table.expand(id, field_id)
.then(this.proxy('draw_table'));
}
if (event.target.attributes['data-col-id'] !== undefined) {
id = event.target.attributes['data-col-id'].nodeValue;
- this.pivot_table.expand_col(id, field_id)
+ this.pivot_table.expand(id, field_id)
.then(this.proxy('draw_table'));
}
},
@@ -195,19 +195,16 @@ instance.web_graph.GraphView = instance.web.View.extend({
handle_header_event: function (options) {
var pivot = this.pivot_table,
id = options.event.target.attributes['data-' + options.type + '-id'].nodeValue,
- header = pivot['get_' + options.type](id);
+ header = pivot.get_header(id);
if (header.is_expanded) {
pivot.fold(header);
this.draw_table();
} else {
- if (header.path.length < pivot[options.type + 's'].groupby.length) {
- // expand the corresponding header
- var field = pivot[options.type + 's'].groupby[header.path.length];
- pivot['expand_' + options.type](id, field)
- .then(this.proxy('draw_table'));
+ if (header.path.length < header.root.groupby.length) {
+ var field = header.root.groupby[header.path.length];
+ pivot.expand(id, field).then(this.proxy('draw_table'));
} else {
- // display dropdown to query field to expand
this.display_dropdown({id:header.id,
type: options.type,
target: $(event.target),