appunto qui alcune note che potrebbero essere utili da riportare in altro modo da altre parti
33a34,52 > function Tables(){ > var items = []; > var getSelectedFromGrid = function(grid_s){ > $.each(grid_s, function(k, v){ > var series = v.getGridParam('selarrrow'); > if (series !== undefined ) { > //Correct the jqgrid bug > series = get_distinct_array(series); > this.items = this.items.concat($.map(series, > function (x, i) { > return v.getCell(x, 'table'); > } > )); > } > }); > return this; > } > } > 39,41c58,59 < var s_els = []; < var a_els = []; < var v_els = []; --- > var tables = new Tables(); > var vector_tags = new Tables(); 44,46c62,64 < s_els.push($('#energy_measures')); < a_els.push($('#energy_alarms')); < v_els.push($('#energy_vectors')); --- > tables.getSelectedFromGrid($('#energy_measures') > vector_tags.getSelectedFromGrid($('#energy_vectors'); 49,99c67,69 < s_els.push($('#energy_measures2')); < a_els.push($('#energy_alarms2')); < s_els.push($('#energy_vectors2')); //vectors details are series (=measures) < } < < var tables = []; < var vector_tags = []; < var i; < < for (i=0; i<s_els.length; i++) { < var s = s_els[i]; < var series = s.getGridParam('selarrrow'); < if (series !== undefined ) { < //Correct the jqgrid bug < series = get_distinct_array(series); < var tables_s = $.map(series, < function (x, i) { < return s.getCell(x, 'table'); < } < ); < tables = tables.concat(tables_s); < } < } < < for (i=0; i<a_els.length; i++) { < var a = a_els[i]; < var alarms = a.getGridParam('selarrrow'); < if (alarms !== undefined ) { < //Correct the jqgrid bug < alarms = get_distinct_array(alarms); < var tables_a = $.map(alarms, < function (x, i) { < return a.getCell(x, 'table'); < } < ); < tables = tables.concat(tables_a); < } < } < < for (i=0; i<v_els.length; i++) { < var v = v_els[i]; < var vectors = v.getGridParam('selarrrow'); < if (vectors !== undefined ) { < //Correct the jqgrid bug < vectors = get_distinct_array(vectors); < vector_tags = $.map(vectors, < function (x, i) { < return v.getCell(x, 'id'); //tags id are in the id element of the grid < } < ); < } --- > tables.getSelectedFromGrid($('#energy_measures2') > .getSelectedFromGrid($('#energy_alarms2') > .getSelectedFromGrid($('#energy_vectors2');//vectors details are series (=measures) 106c76 < return issue_download_aggregates(tables, vector_tags, from, to, graph_options.aggregate_by, form_command_el); --- > return issue_download_aggregates(tables.items, vector_tags.items, from, to, graph_options.aggregate_by, form_command_el);