$(document).ready(function(){
function datiTabella(that){
$('.menu-tabella').removeClass('active');
$(that).addClass('active');
$('#tabella').empty();
var html = '
';
html += 'Mese | ';
html += 'Valore quota (€) | ';
//html += 'Patrimonio (€) | ';
html += '
';
html += '';
$('#tabella').html('');
$.getJSON('/grafici/tabella.php', 'c=29&lang=', function(data, textStatus, jqxhr){
var anno = $('.menu-tabella.active').attr('id');
$.each(data, function(i, obj){
if(obj.anno == anno || anno == 'all'){
html += '';
html += '' + obj.data + ' | ';
html += '' + (obj.valore? obj.valore: '') + ' | ';
//html += '' + (obj.andp? obj.andp: '') + ' | ';
html += '
';
}
});
html += '';
html += '
';
$('#tabella').html(html);
});
return false;
}
function menuAnni(){
var anno;
var html = '';
$('#tabellaMenu').empty();
$.getJSON('/grafici/tabella.php', 'c=29&lang=&a=5', function(data, textStatus, jqxhr){
var first = true;
$.each(data, function(i, obj){
if(obj.anno != anno && obj.anno > 1){
html += '';
anno = obj.anno;
first = false;
}
});
$('#tabellaMenu').html(html).append('');
$('.menu-tabella').on('click', function(e){
return datiTabella(this);
});
datiTabella($('.menu-tabella.active'));
});
}
menuAnni();
});