From 12769acc7223992f2e2f7ea9316625022b2a39c6 Mon Sep 17 00:00:00 2001 From: renato Date: Mon, 16 May 2016 11:01:55 +0200 Subject: [PATCH] preselect bug --- controllets/select-visualization-controllet/select-datalet-inputs_series.html | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- controllets/select-visualization-controllet/select-visualization-controllet.html | 2 +- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/controllets/select-visualization-controllet/select-datalet-inputs_series.html b/controllets/select-visualization-controllet/select-datalet-inputs_series.html index ab4e8e1..311ee8d 100644 --- a/controllets/select-visualization-controllet/select-datalet-inputs_series.html +++ b/controllets/select-visualization-controllet/select-datalet-inputs_series.html @@ -205,35 +205,68 @@ } if(aggregators.length > 0) { - this.selectedFields = [fields[0], fields[2]]; + if(fields.length == 2) { + this.selectedFields = [fields[0], fields[1]]; + + this.$.group_by.removeAttribute("disabled"); + $("#calculate_0")[0].removeAttribute("disabled"); + $("#gb")[0].removeAttribute("disabled"); + this._showExpertMode(); + + var groupableFields = []; + for (var i = 0; i < this.fields.length; i++) { + if(this.fields[i] != this.selectedFields[1]) + groupableFields.push(this.fields[i]); + } + this.groupableFields = this._copy(groupableFields); + this.aggregateFields = [this.selectedFields[1]]; - this.$.group_by.removeAttribute("disabled"); - $("#calculate_0")[0].removeAttribute("disabled"); - $("#gb")[0].removeAttribute("disabled"); - this._showExpertMode(); + $(ddls[0]).find("paper-menu")[0].select(1); + $(ddls[1]).find("paper-menu")[0].select(2); - var groupableFields = []; - for (var i = 0; i < this.fields.length; i++) { - if(this.fields[i] != this.selectedFields[1]) - groupableFields.push(this.fields[i]); + this.async(function () { + var i = this.functions.indexOf(aggregators[1].operation); + + $(this.$.group_by).find("paper-menu")[0].select(1); + $("#calculate_0").find("paper-menu")[0].select(i); + +// this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled"); + this.aggregators = this._copy(aggregators); + + this.fireReady(); + }, 0); } - this.groupableFields = this._copy(groupableFields); - this.aggregateFields = [this.selectedFields[1]]; + else/*if(fields.length == 3)*/ { + this.selectedFields = [fields[0], fields[2]]; + + this.$.group_by.removeAttribute("disabled"); + $("#calculate_0")[0].removeAttribute("disabled"); + $("#gb")[0].removeAttribute("disabled"); + this._showExpertMode(); + + var groupableFields = []; + for (var i = 0; i < this.fields.length; i++) { + if(this.fields[i] != this.selectedFields[1]) + groupableFields.push(this.fields[i]); + } + this.groupableFields = this._copy(groupableFields); + this.aggregateFields = [this.selectedFields[1]]; - $(ddls[0]).find("paper-menu")[0].select(1); - $(ddls[1]).find("paper-menu")[0].select(3); + $(ddls[0]).find("paper-menu")[0].select(1); + $(ddls[1]).find("paper-menu")[0].select(3); - this.async(function () { - var i = this.functions.indexOf(aggregators[2].operation); + this.async(function () { + var i = this.functions.indexOf(aggregators[2].operation); - $(this.$.group_by).find("paper-menu")[0].select(2); - $("#calculate_0").find("paper-menu")[0].select(i); + $(this.$.group_by).find("paper-menu")[0].select(2); + $("#calculate_0").find("paper-menu")[0].select(i); // this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled"); - this.aggregators = this._copy(aggregators); + this.aggregators = this._copy(aggregators); - this.fireReady(); - }, 0); + this.fireReady(); + }, 0); + } } else this.fireReady(); diff --git a/controllets/select-visualization-controllet/select-visualization-controllet.html b/controllets/select-visualization-controllet/select-visualization-controllet.html index e3c5b32..1459525 100755 --- a/controllets/select-visualization-controllet/select-visualization-controllet.html +++ b/controllets/select-visualization-controllet/select-visualization-controllet.html @@ -302,7 +302,7 @@ // }, 1); }, - _preselectDatalet : function() {console.log("preselzionando si impara"); + _preselectDatalet : function() { this.$.vslider._preselectDatalet(); this.async(function () { -- libgit2 0.21.4