Nov 22, 2009

Ascend Descend Sorting

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > JavaScript

Ascend Descend Sorting

Klass
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:
CODE
<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']}&nbsp;&nbsp;<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.

 

 

 


Comment/Reply (w/o sign-up)

vizskywalker
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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Ascend Descend Sorting


    Looking for ascend, descend, sorting

See Also,

*SIMILAR VIDEOS*
Searching Video's for ascend, descend, sorting
advertisement



Ascend Descend Sorting

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com