How to toggle Report Pagination with visualize.js?

I want to toggle the Report Pagination in an interactive Report with Visualize.js. I have a checkbox and if this checkbox is checked, the Report should be rendered paginated. If the checkbox is unchecked, the Report should be rendered without pagination. Based on the Visualize.js Live-Sample for Pagination Events I came up with the following Idea: HTML-Snippet: Pagination Javascript-Snippet: $("#reportPagination").on("change", function() { var checkState = $(this); if(checkState.is(":checked")) reportPagination = false; else reportPagination = true; console.log("Re-Running Report with ignorePagination: " + reportPagination); report .pages(currentPage) .run({ ignorePagination: reportPagination }) .done(checkPagesConditions) .fail(function(err) { alert(err); }); }); Full Example: JSFiddle Report Pagination It did not work, the Report stays in intial pagination state (in my example it remains paginated). How can I get this to work? Greetings, Andreas
Andreas Kügler's picture
Joined: Aug 5 2019 - 3:39am
Last seen: 4 days 13 min ago

Thanks a lot @narcism, that was exactly what I'm looking for.

Andreas Kügler - 3 years 1 month ago

1 Answer:

In this case, the ignorePagination property is read-only, so once set, it cannot be changed unless you completely rerun the report. I've altered your fiddle here: jsfiddle.

In essence, I destroy the previous instance and then reset the report reference to the new one with the ignorePagination according to the checkbox.

narcism's picture
5564
Joined: Nov 22 2010 - 12:39am
Last seen: 22 min 37 sec ago
Feedback
randomness