kchavda Posted April 4, 2016 Share Posted April 4, 2016 Hello,I want to set pagination in my drill report using visualize.js, but i am not able do this. Link to comment Share on other sites More sharing options...
jclarke_1 Posted April 20, 2016 Share Posted April 20, 2016 Have you set the report up to be paginated? There are steps you need to take in Jasper studio to make the report HTML appear one page at a time. From there, you can use visualize to page forward and back. Here's a code snippet from our app (we are using AngularJS): var _goToPage = function(pageNum) { var deferred = $q.defer(); $rootScope.isLoading = true; _report.pages(pageNum).run() .done(function(data) { $rootScope.isLoading = false; deferred.resolve(true); }) .fail(function(err) { $rootScope.isLoading = false; deferred.resolve(false); _handleError("An error occurred while trying to load the specified page of this report.", err); }); return deferred.promise; }; Also, you'll need to be able to determine the total number of pages to prevent the user from paging past the end. The way this is implemented in Visualize is a little weird - you need to grab a callback when the report is built, like this: _report = _reportService.report({ resource: uri, container: containerId, runImmediately: false, events: { changeTotalPages: function(totalPages) { EventService.pub("PAGE_COUNT_CHANGED", {pageCount: totalPages, container: containerId}); } }, linkOptions: { events: { "click": function(evt, link){ _fireReportClickEvent(evt, link); } } }, error: function (err) { _handleError("An error occurred while attempting to load the list of reports. " + err.message, err); } }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now