Problem with jQuery plugin TinySort

Posted by Volmar on Stack Overflow See other posts from Stack Overflow or by Volmar
Published on 2010-04-05T20:41:24Z Indexed on 2010/04/05 20:43 UTC
Read the original article Hit count: 289

Filed under:
|
|
|

I'm trying to sort a list with the help of jQuery and the TinySort-plugin, and it works good but one thing is not working as i want. My Code is:

<!doctype html> 
<html> 
    <head> 
        <meta charset="UTF-8" /> 
        <title>TinySort problem</title> 
        <script type="text/javascript" src="http://so.volmar.se/www/js/jquery.js"></script> 
        <script type="text/javascript" src="http://so.volmar.se/www/js/jquery.tinysort.min.js"></script> 
<script type="text/javascript">
function pktsort(way){
    if($("div#paket>ul>li.sortdiv>a#s_abc").text() == "A-S"){
        $("div#paket>ul>li.sortdiv>a#s_abc").text("S-A");
        $("div#paket ul li.sortable").tsort("",{place:"org",returns:true,order:"desc"});
    }else{
        $("div#paket>ul>li.sortdiv>a#s_abc").text("A-S");
        $("div#paket ul li.sortable").tsort("",{place:"org",returns:true,order:"asc"});
    }
}
</script>

    </head> 
<body> 
<div id="paket" title="Paket"> 
    <ul class="rounded"> 
        <li class="sortdiv">Sort: <a href="#" onclick="pktsort();" class="active_sort" id="s_abc">A-S</a></li> 
        <li class="sortable">Almost Famous</li> 
        <li class="sortable">Children of Men</li> 
        <li class="sortable">Coeurs</li> 
        <li class="sortable">Colossal Youth</li> 
        <li class="sortable">Demonlover</li> 
        <li class="sortable">Femme Fatale</li> 
        <li class="sortable">I'm Not There</li> 
        <li class="sortable">In the City of Sylvia</li> 
        <li class="sortable">Into the Wild</li> 
        <li class="sortable">Je rentre à la maison</li> 
        <li class="sortable">King Kong</li> 
        <li class="sortable">Little Miss Sunshine</li> 
        <li class="sortable">Man on Wire</li> 
        <li class="sortable">Milk</li> 
        <li class="sortable">Monsters Inc.</li> 
        <li class="sortable">My Winnipeg</li> 
        <li class="sortable">Ne touchez pas la hache</li> 
        <li class="sortable">Nói albinói</li> 
        <li class="sortable">Regular Lovers</li> 
        <li class="sortable">Shaun of the Dead</li> 
        <li class="sortable">Silent Light</li> 
        <li class="addmore"><b>This text is not supposed to move</b></li>
    </ul> 
</div>
</body>
</html>

you can try it out at: http://www.volmar.se/list-prob.html

MY PROBLEM IS: I don't want the <li class="addmore"> to move above all the <li class="sortable">-elements when i press the sort-link. i wan't it to always be in the bottom.

you can find documentation of the TinySort plugin here. i've tried loads of combinations with place and returns propertys but i just can't get it right.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about sorting