Commit 12769acc7223992f2e2f7ea9316625022b2a39c6

Authored by Renato De Donato
1 parent 806cd7db

preselect bug

controllets/select-visualization-controllet/select-datalet-inputs_series.html
... ... @@ -205,35 +205,68 @@
205 205 }
206 206  
207 207 if(aggregators.length > 0) {
208   - this.selectedFields = [fields[0], fields[2]];
  208 + if(fields.length == 2) {
  209 + this.selectedFields = [fields[0], fields[1]];
  210 +
  211 + this.$.group_by.removeAttribute("disabled");
  212 + $("#calculate_0")[0].removeAttribute("disabled");
  213 + $("#gb")[0].removeAttribute("disabled");
  214 + this._showExpertMode();
  215 +
  216 + var groupableFields = [];
  217 + for (var i = 0; i < this.fields.length; i++) {
  218 + if(this.fields[i] != this.selectedFields[1])
  219 + groupableFields.push(this.fields[i]);
  220 + }
  221 + this.groupableFields = this._copy(groupableFields);
  222 + this.aggregateFields = [this.selectedFields[1]];
209 223  
210   - this.$.group_by.removeAttribute("disabled");
211   - $("#calculate_0")[0].removeAttribute("disabled");
212   - $("#gb")[0].removeAttribute("disabled");
213   - this._showExpertMode();
  224 + $(ddls[0]).find("paper-menu")[0].select(1);
  225 + $(ddls[1]).find("paper-menu")[0].select(2);
214 226  
215   - var groupableFields = [];
216   - for (var i = 0; i < this.fields.length; i++) {
217   - if(this.fields[i] != this.selectedFields[1])
218   - groupableFields.push(this.fields[i]);
  227 + this.async(function () {
  228 + var i = this.functions.indexOf(aggregators[1].operation);
  229 +
  230 + $(this.$.group_by).find("paper-menu")[0].select(1);
  231 + $("#calculate_0").find("paper-menu")[0].select(i);
  232 +
  233 +// this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled");
  234 + this.aggregators = this._copy(aggregators);
  235 +
  236 + this.fireReady();
  237 + }, 0);
219 238 }
220   - this.groupableFields = this._copy(groupableFields);
221   - this.aggregateFields = [this.selectedFields[1]];
  239 + else/*if(fields.length == 3)*/ {
  240 + this.selectedFields = [fields[0], fields[2]];
  241 +
  242 + this.$.group_by.removeAttribute("disabled");
  243 + $("#calculate_0")[0].removeAttribute("disabled");
  244 + $("#gb")[0].removeAttribute("disabled");
  245 + this._showExpertMode();
  246 +
  247 + var groupableFields = [];
  248 + for (var i = 0; i < this.fields.length; i++) {
  249 + if(this.fields[i] != this.selectedFields[1])
  250 + groupableFields.push(this.fields[i]);
  251 + }
  252 + this.groupableFields = this._copy(groupableFields);
  253 + this.aggregateFields = [this.selectedFields[1]];
222 254  
223   - $(ddls[0]).find("paper-menu")[0].select(1);
224   - $(ddls[1]).find("paper-menu")[0].select(3);
  255 + $(ddls[0]).find("paper-menu")[0].select(1);
  256 + $(ddls[1]).find("paper-menu")[0].select(3);
225 257  
226   - this.async(function () {
227   - var i = this.functions.indexOf(aggregators[2].operation);
  258 + this.async(function () {
  259 + var i = this.functions.indexOf(aggregators[2].operation);
228 260  
229   - $(this.$.group_by).find("paper-menu")[0].select(2);
230   - $("#calculate_0").find("paper-menu")[0].select(i);
  261 + $(this.$.group_by).find("paper-menu")[0].select(2);
  262 + $("#calculate_0").find("paper-menu")[0].select(i);
231 263  
232 264 // this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled");
233   - this.aggregators = this._copy(aggregators);
  265 + this.aggregators = this._copy(aggregators);
234 266  
235   - this.fireReady();
236   - }, 0);
  267 + this.fireReady();
  268 + }, 0);
  269 + }
237 270 }
238 271 else
239 272 this.fireReady();
... ...
controllets/select-visualization-controllet/select-visualization-controllet.html
... ... @@ -302,7 +302,7 @@
302 302 // }, 1);
303 303 },
304 304  
305   - _preselectDatalet : function() {console.log("preselzionando si impara");
  305 + _preselectDatalet : function() {
306 306 this.$.vslider._preselectDatalet();
307 307  
308 308 this.async(function () {
... ...