Zerivo Posted May 8, 2015 Share Posted May 8, 2015 (edited) 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 May 8, 2015 by Zerivo Link to comment Share on other sites More sharing options...
davej Posted May 8, 2015 Share Posted May 8, 2015 How does the table get loaded? Where is the table data located? Link to comment Share on other sites More sharing options...
Zerivo Posted May 8, 2015 Author Share Posted May 8, 2015 it is just empty, only table. i can't find code to sort. it is like i want, on site: http://tablesorter.com/docs/example-parsers.html i try and try but no luck Link to comment Share on other sites More sharing options...
davej Posted May 8, 2015 Share Posted May 8, 2015 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 More sharing options...
Ingolme Posted May 8, 2015 Share Posted May 8, 2015 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now