문제

jQuery Tablesterter를 사용하여 테이블을 정렬하고 모든 것이 예상대로 작동합니다. 내가하고 싶은 것은 "정렬별로"라인을 따라 무언가를 말하는 내 테이블 위에 링크를 추가하는 것입니다. 사용자가 링크를 클릭하면 "가격"열을 정렬하기를 원합니다. 또한 다시 클릭하면 가격을 다른 방식으로 정렬합니다. 이게 가능해?

감사! 마노 즈

도움이 되었습니까?

해결책

에서 tablestertor.com

$(document).ready(function() { 
    $("table").tablesorter(); 
    $("#trigger-link").click(function() { 
        // set sorting column and direction, this will sort on the first and third column the column index starts at zero 
        var sorting = [[0,0],[2,0]]; 
        // sort on the first column 
        $("table").trigger("sorton",[sorting]); 
        // return false to stop default link action 
        return false; 
    }); 
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top