Jump to content
Changes to the Jaspersoft community edition download ×

How to enable/disable next and previous buttons for pagination using visualize js


Recommended Posts

I am not able to enable/disable next and previous pagination buttons. it works fine for first time but when i refine report again then it doesnt work as expected. Below is code ;

Visualize js Code :

reportCompleted: function (status) {
                    if(report.data().totalPages > 1){
                    $('#nextPage').removeClass('not-active');
                    }else{
                    $('#nextPage').addClass('not-active');    
                    }
                    if(report.pages() == 1){
                    $('#prevPage').addClass('not-active');        
                    }else{
                    $('#prevPage').removeClass('not-active');            
                    }
                    if(report.pages() == report.data().totalPages){
                    $('#nextPage').addClass('not-active');        
                    }
                    
                }

Pagination Code :

 $("#prevPage").click(function () {
                  var currentPage = report.pages() || 1;
                report.pages(--currentPage).run()
                        .fail(function (err) {
                        });
              
            });
            $("#nextPage").click(function () {
                var currentPage = report.pages() || 1;
                report.pages(++currentPage).run()
                .fail(function (err) {
                        });
                
            })

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...