Search code examples
jquerytablesorter

Jquery tablesorter only sort first page's data only


I am currently using Jquery tablesorter and Jqpaginator in my current application. Jquery tablesorter works fines when page is loaded for first time but when i click jqpaginator and get next page data, data is overlapped and sorted data of first page is shown in second page too.

P.S. PageSize of my appication is 5

Here is the snapshot of the problem: tablesorter at page 1 working

tablesorter at page 2 not working tablesorter code

 AddTableSorter: function () {

            $("table").tablesorter({
                theme: 'blue', sortList: [[0, 0]]
            });
            CompanyTypeEdit.UIEvents();
        },

jqpaginator code:

   LoadCompanyTypePagination: function (totalPages, CurrentPage) {
            totalPages = (parseInt(totalPages));
            if (totalPages < 1) {

            }
            else {
                $.jqPaginator('#pagination1', {

                    totalPages: totalPages,
                    visiblePages: 3,
                    currentPage: CurrentPage,
                    onPageChange: function (num, type) {
                            CompanyTypeEdit.config.PageIndex = num;
                            console.log('rest' + num);
                            $('table').trigger('sortReset');
                            CompanyTypeEdit.GetAllCompanyType();


                    }
                });

            }
            CompanyTypeEdit.UIEvents();
        },

Solution

  • I don't know if anyone had this problem or not but i somehow manage to solve this problem. I just added

     $('table').trigger('update');
    

    in my LoadCompanyTypePagination() function and every thing worked perfectly..!!