Jump to content
Sign in to follow this  
Zerivo

Sort Table

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...