html - page break after creating certain charts using JQuery -
i going generate several charts, first page should have header , first 8 charts, how can page break after 8th chart , go second page not have header. each student have data record containing several subjects , scores therefore each report has several charts each subjects.
var counter = 1; $.get('/rest/report/' + id, function (data) { data.subjects.foreach(function (subject, idx) { console.log(idx); var container = $('<div class="one-chart"></div>')[0]; if (counter < 8) { $('.charts-container').last().append(container); renderonechart(container, subject.name, subject.scores); counter++; } }); }); $('body').append('<div class="page" ></div>'); });
i think may able target every eighth chart, , use page-break-after: always
ensure page break.
for instance, if each chart has .chart
class, this:
.chart:nth-child(8n) { page-break-after: always; }
here's jsfiddle.
Comments
Post a Comment