rubenvanassche / Programming-Project-Databases

A World championship statistics website
coachcenter.be
GNU General Public License v3.0
1 stars 1 forks source link

Ajax Shit in tabs #70

Closed rubenvanassche closed 10 years ago

JakobStruye commented 10 years ago

Finally managed to get the graphs working in an Ajax tab in c9b880d4d4af56d406054e4119dc1c433bb7b150. The trick was to put the script generating the graph in team.blade.php (and not graph.blade.php) but make sure that the js function generating it is not called until the Graph tab is clicked. Otherwise it finds no place to draw it and crashes silently. I accomplished this by replacing

google.setOnLoadCallback(drawChart1(resultData)); 

with

    $('#graphs').on('click',function(){               

        $.ajax({

            data: "",
            success: function(resultData){
                google.setOnLoadCallback(drawChart1(resultData));                                                   
            }
        });     
    });

Massive props to http://stackoverflow.com/questions/10870419/load-google-charts-via-ajax

Note: If you don't see the graphs immediately, don't panic, they take a few seconds to render

JakobStruye commented 10 years ago

Done