summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-11-25 09:06:53 +0100
committerGery Debongnie <ged@openerp.com>2013-11-25 09:06:53 +0100
commit86a2d41d24045e1ba020199c998d315a5c8d9b10 (patch)
treec3ecf27d5ff7a7356f25074580e8ee64222297c6 /addons/web_graph/static/src
parent2944752844ee3a98b4a5e0a2c35634a034b88acb (diff)
[IMP] adds expand_all button and method to graph view. beware, the code is not efficient (it does lots of db queries) (addon web_graph)
bzr revid: ged@openerp.com-20131125080653-n3lgq7lb3kb3ygg7
Diffstat (limited to 'addons/web_graph/static/src')
-rw-r--r--addons/web_graph/static/src/js/graph.js4
-rw-r--r--addons/web_graph/static/src/js/pivot.js17
-rw-r--r--addons/web_graph/static/src/xml/web_graph.xml1
3 files changed, 22 insertions, 0 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index e1234e6f489..0a6a2fd15db 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -69,6 +69,10 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.heat_map_mode = !this.heat_map_mode;
this.draw_table();
},
+
+ 'click label.graph_expand_all' : function (event) {
+ this.pivot_table.expand_all().then(this.proxy('draw_table'));
+ },
},
view_loading: function (fields_view_get) {
diff --git a/addons/web_graph/static/src/js/pivot.js b/addons/web_graph/static/src/js/pivot.js
index e310a7799f6..0dfacf5cb06 100644
--- a/addons/web_graph/static/src/js/pivot.js
+++ b/addons/web_graph/static/src/js/pivot.js
@@ -185,6 +185,23 @@ var PivotTable = openerp.web.Class.extend({
this.fold_cols();
},
+ expand_all: function () {
+ var self = this;
+ // temporary code, to use while waiting for correct code.
+ // this code expands all rows/cols by doing as many db queries.
+ // correct code widd do that with just 1 request.
+ var header_to_expand = _.find(this.rows.headers.concat(this.cols.headers), function (header) {
+ return ((!header.is_expanded) && (header.path.length < header.root.groupby.length))
+ });
+ if (header_to_expand === undefined) {
+ return $.when();
+ } else {
+ return this.expand(header_to_expand.id, header_to_expand.root.groupby[header_to_expand.path.length]).then(function () {
+ return self.expand_all();
+ });
+ }
+ },
+
});
diff --git a/addons/web_graph/static/src/xml/web_graph.xml b/addons/web_graph/static/src/xml/web_graph.xml
index d9353778bcf..273ff90dac4 100644
--- a/addons/web_graph/static/src/xml/web_graph.xml
+++ b/addons/web_graph/static/src/xml/web_graph.xml
@@ -17,6 +17,7 @@
<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>
<label type="button" class="btn btn-default graph_heat_map">Heat Map</label>
+ <label type="button" class="btn btn-default graph_expand_all">Expand All</label>
</div>
</div>
<div class="graph_main_content"></div>