Show Number Of Pages Of Paginated Report

1

Hi, I'm using visualize.js to display paginated reports.  I have the "Previous" and "Next" controls working, but I was curious if there was a way to display the number of pages and/or the number of results in the table.  For example, it could display "Page 1 of 8".  Or if you wanted t display the number of results, it could say "Showing 1 to 25 of 128 results".

Any ideas? 

tmcbroom's picture
Joined: Jul 7 2014 - 7:15am
Last seen: 4 years 8 months ago

Use the 'changeTotalPages' event to capture the number of pages int the report. The event will fire only when the number of pages in the report changes.  This is what I am using.  See the programming guide 

e.g.
 
var rerport = v.report({
            resource: 'public/reports/myreportURI',
            container:'#container',
            events: {
                reportCompleted: function(status) {
                    console.log('Visualize:Report Completed');
                },
                changeTotalPages: function(totalPages) {
 
                    console.log(totalPages);
 
                },
                pageFinal: function(el) {
 
                },
                beforeRender: function(el) {
 
                }
            }
 
        });
 
 
paul.edmondson - 4 years 9 months ago

Worked like a charm!  Thanks for your help.

tmcbroom - 4 years 9 months ago

Can you please help me. I need to implement same but not able to get the next option to change the page

honeybakliwal - 4 years 7 months ago

2 Answers:

2

If you want to check it out, here is a sample of that https://github.com/marianol/JasperEmbedSample/blob/master/context-ic.html

marianol's picture
4247
Joined: Sep 13 2011 - 8:04am
Last seen: 6 months 2 weeks ago
0

From the above URL given by marianol:

var report = v.report({
        resource: reportUrl,
        container: "#jasperReportsContainer",
        success : function() {
               //report is rendered
        }
});
 
report.events({
        changeTotalPages: function(totalPages) {
            $('#totalPages').html(totalPages); //here you get the totalPages in report
        }
});
tusar.busybird's picture
Joined: Jul 23 2015 - 2:55am
Last seen: 3 years 2 months ago
Feedback