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

0

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) {
                        });
                
            })

 

sudama.patidar_1's picture
Joined: May 30 2016 - 9:19pm
Last seen: 1 year 2 months ago

0 Answers:

No answers yet
Feedback
randomness