Klass 0 Report post Posted June 16, 2005 I am at a loss for trying to use javascript to ascend descend sort my columns.Here is the code I am trying to sort: <tr> <td class='row$row' width="25%"><a href="{ipb.script_url}act=army&userstat={$user['id']}">{$user['name']}</td> <td class='row$row' width="15%">{$user['rank']}</td> <td class='row$row' width="10%" align=right>{$user['army']}</td> <td class='row$row' width="10%">{$user['racename']} <img src='{$user['raceicon']}' border='0' height=28 width=28></td> <td class='row$row' width="15%" align=right>{$user['money']}</td> <!--attack--><td class='row$row' width="30%" align=center><b><a href="{ipb.script_url}act=army&CODE=05&ID={$user['id']}">{ipb.lang['atkuser']}</a></b></td><!--attack--></tr>The things that need to be sorted are: 'name', 'army', 'money'.Want to sort 'rank' by default, which is how the code/database is already set. Then when user wants to sort use above in a javascript. Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted June 16, 2005 Let me get this straight. Currently the system sorts by rank, but you want the user to be able to sort by name, army, and money. First of all, sorting by money (since this is for the army system) would allow users to get a feel for who has what amount even if it is question marks instead of a gold listing because there spy is too low. Then let me refer you to this thread which talks about various sorting algorithms. I would use qwijibow's bubble sort as it is fast and not very complicated. However, quicksort will work as well. Both are well documented and a search should provide all the information you need if (as I suspect you are) you are capable of taking an algorithm and coding it.~Viz Share this post Link to post Share on other sites