Jump to content

Sort Table


Zerivo

Recommended Posts

Hi i need help for make sort table

I want to sort on table, like Shop name, sell type and location etc so if i press button sort location then sort a-z from top to bottom.

how i can do it? like it:
<table border="1">
<tr><td>Shop name</td><td>Type shop</td><td>location </td></tr>
<tr><td>The Common Defense</td><td>Armor Shop</td><td>New Sorpigal</td></tr>
<tr><td>The Eagle's Eye</td><td>Weapon Shop</td><td>Castle Ironfist</td></tr>
<tr><td>Smoke and Mirrors</td><td>Alchemist Shop</td><td>Mire of Damned</td></tr>
</table>
so, how i sort those? i try find but hard to found right code.
Edited by Zerivo
Link to comment
Share on other sites

Well, that page has everything. If you simply want to sort static data in a table you can download that page and then modify it. You can also use "view source" in your browser to see what they are doing. The code they display on the page isn't the whole story.

Link to comment
Share on other sites

Is there a problem with using that jQuery plug-in?

 

You just need to be sure your table is structured properly with a <thead> and <tbody>

 

Your code should be like this:

<table>    <thead>        <tr><th>Shop name</th><th>Type shop</th><th>location </th></tr>    </thead>    <tbody>        <tr><td>The Common Defense</td><td>Armor Shop</td><td>New Sorpigal</td></tr>        <tr><td>The Eagle's Eye</td><td>Weapon Shop</td><td>Castle Ironfist</td></tr>        <tr><td>Smoke and Mirrors</td><td>Alchemist Shop</td><td>Mire of Damned</td></tr>    </tbody></table>

Then you can follow the instructions they give with the plug-in

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...