Monday, 26 August 2013

populate google chart datatable with arrayToDataTable in django template

populate google chart datatable with arrayToDataTable in django template

I have a list of tuples passed to the template. I want to populate a
datatable with it. Here is the code. Does anyone know what is wrong with
it? Currently nothing shows on the webpage. Thank you.
var dt=new google.visualization.arrayToDataTable([
['Name','LastGPA','CurGPA','IntervalA','IntervalB','Major'],
{% for d in data %}
[{{d.0}},{{d.1}},{{d.2}},{{d.3}},{{d.4}},{{d.5}}]
{% if not forloop.last %},{% endif %}
{% endfor %}
]);
summary_table.draw(dt);

No comments:

Post a Comment