Pregunta

Estoy usando jQuery Tablesorter para ordenar una mesa y todo funciona como se esperaba. Lo que me gustaría hacer es añadir un enlace por encima de mi mesa que dice algo en la línea de "Ordenar por Precio" y cuando el usuario hace clic en el enlace que quiero la columna "Precio" para ordenar. Además, si hacen clic de nuevo, sería ordenar el precio de la otra manera. ¿Es esto posible?

Gracias! Manoj

¿Fue útil?

Solución

tablesorter.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; 
    }); 
});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top