2016-01-23 67 views
0

在這裏我正在排序正確,但按降序排序時,它會轉到分頁的最後一頁。請給出任何想法,而不改變分頁號碼。用分頁排序(jQuery)

function SortbyPrice(type){ 
 
    if (type == 'ascending') { 
 
    $(".holdereBookings .jp-previous").next().trigger("click"); 
 
     $('div.HotelInfoBox').map(function() { 
 
     return {val: parseFloat($(this).data('price')), el: this}; 
 
     }).sort(ascending).map(function() { 
 
     return this.el; 
 
     }).appendTo('.hotel-list'); 
 
    }else{ 
 
    $(".holdereBookings .jp-next").prev().trigger("click"); 
 
    $('div.HotelInfoBox').map(function() { 
 
     return {val: parseFloat($(this).data('price')), el: this}; 
 
     }).sort(descending).map(function() { 
 
\t return this.el; 
 
     }).appendTo('.hotel-list'); 
 
    } 
 
}

回答

0

,你的分頁做目前尚不清楚。希望以下可幫助:

  1. 先升序排列。
  2. 切片當前頁面的項目。
  3. 對這些項目進行降序排序。