diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-23 12:42:01 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-23 12:42:01 +0100 |
| commit | 42e38292b8ba13f54349203a16e9b61e33ebfe7b (patch) | |
| tree | 46b008cc94bd5195de10ca5e269ece230961c5e1 /addons/web_graph/static/src/js/graph.js | |
| parent | 0f995a25d5bb467dfb309a9f197a1f7e962b2445 (diff) | |
[REF] slight modifications to the underlying data structure of pivot table in addon web_graph
bzr revid: ged@openerp.com-20131123114201-g6v6q9r15n9gdzg2
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 4d74ad71121..cd6cb44f93c 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -186,9 +186,9 @@ instance.web_graph.GraphView = instance.web.View.extend({ pivot['fold_' + options.type](header); this.draw_table(); } else { - if (header.path.length < pivot[options.type + '_groupby'].length) { + if (header.path.length < pivot[options.type + 's'].groupby.length) { // expand the corresponding header - var field = pivot[options.type + '_groupby'][header.path.length]; + var field = pivot[options.type + 's'].groupby[header.path.length]; pivot['expand_' + options.type](id, field) .then(this.proxy('draw_table')); } else { @@ -205,7 +205,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ display_dropdown: function (options) { var self = this, pivot = this.pivot_table, - already_grouped = pivot.row_groupby.concat(pivot.col_groupby), + already_grouped = pivot.rows.groupby.concat(pivot.cols.groupby), possible_groups = _.difference(self.data.important_fields, already_grouped), dropdown_options = { fields: _.map(possible_groups, function (field) { @@ -224,7 +224,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ draw_table: function () { this.table.empty(); this.draw_top_headers(); - _.each(this.pivot_table.rows, this.proxy('draw_row')); + _.each(this.pivot_table.rows.headers, this.proxy('draw_row')); }, make_border_cell: function (colspan, rowspan) { @@ -244,7 +244,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ draw_top_headers: function () { var self = this, pivot = this.pivot_table, - height = _.max(_.map(pivot.cols, function(g) {return g.path.length;})), + height = _.max(_.map(pivot.cols.headers, function(g) {return g.path.length;})), header_cells = [[this.make_border_cell(1, height)]]; function set_dim (cols) { @@ -277,11 +277,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ } } - set_dim(pivot.cols[0]); // add width and height info to columns headers - if (pivot.cols[0].children.length === 0) { - make_cells(pivot.cols, 0); + set_dim(pivot.cols.main); // add width and height info to columns headers + if (pivot.cols.main.children.length === 0) { + make_cells(pivot.cols.headers, 0); } else { - make_cells(pivot.cols[0].children, 1); + make_cells(pivot.cols.main.children, 1); } _.each(header_cells, function (cells) { @@ -302,7 +302,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ html_row.append(row_header); - _.each(pivot.cols, function (col) { + _.each(pivot.cols.headers, function (col) { if (col.children.length === 0) { var cell = $('<td></td>').append(pivot.get_value(row.id, col.id)); html_row.append(cell); |
