How can I remove the last page number and ellipsis from pagination(which loses CSS on sort)?

How can I remove the last page number and ellipsis from pagination(which loses CSS on sort)?

PrateekParekhPrateekParekh Posts: 13Questions: 3Answers: 0
edited October 2015 in Free community support

I have an ajax+json populated datatables but every time I sort a column, the ellipsis shows up and the pagination loses it's classes.
Also, I want to remove the last page number : Previous 1 2 3 4 5 19 Next
I want to remove 19..

          
                        $("#source_previous").attr('class', 'paginate_enabled_previous');
            $("#source_next").attr('class', 'paginate_enabled_next');
                        
         
                        var settings = stockTable.fnSettings();
            var total = settings.fnRecordsDisplay();
            var l = Math.ceil(total/settings._iDisplayLength);
            var page = Math.ceil(settings._iDisplayStart/settings._iDisplayLength)+1;

                        if(page === 1){
                $('#source_previous').attr('class','paginate_disabled_previous');
                if(l === 1) {
                    $('#source_next').attr('class','paginate_disabled_next');
                                    }
            }
                        else if(page === l ){
                $('#source_next').attr('class','paginate_disabled_next');
            }
                        else {
                             $("#source_previous").attr('class', 'paginate_enabled_previous');
                             $("#source_next").attr('class', 'paginate_enabled_next');
                        }

This question has an accepted answers - jump to answer

Answers

  • PrateekParekhPrateekParekh Posts: 13Questions: 3Answers: 0

    Ellipsis can be hidden but is there a way to modify pagination?

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin
    Answer ✓

    You would need to create a paging plug-in - there is no way to remove that information in the built in pagination control. I feel it is needed to let users know that there are more than just 5 pages.

    Allan

This discussion has been closed.