Re: Table sorting

Discussion in 'HTML' started by Andy, Jun 28, 2013.

  1. Andy

    Andy Guest

    "Ed Mullen" <> wrote in message
    news:...
    > I Googled on how to dynamically sort tables and found too many
    > possibilities. Anyone here have a preferred method for doing this?
    >
    >
    > --
    > Ed Mullen
    > http://edmullen.net/
    > Don't bother me. I'm living happily ever after.
    >


    Hi Ed,

    Have a look at this sortable table to see if it does what you need...

    http://www.microbuild.com/mygardenproject/data.php

    ....if you want to use it then follow these steps...

    1: Download the javascript file from
    http://www.microbuild.com/mygardenproject/includes/sorttable.js

    2: Include the js in your html file <script
    src="includes/sorttable.js"></script>

    3: Add some CSS to your stylesheet...

    Example...

    table.sortable thead { background-color:#DCE9D9; font-weight: bold;
    font-size: 80%; cursor: hand; cursor: pointer; -moz-outline-style: none;
    hidefocus; }
    table.sortable th { border: solid 1px #375D37; color:#375D37; }
    table.sortable td { border: solid 1px #375D37; color:#666666; font-size:
    60%; }

    4: Use the following structure for your tables...

    Example...

    <table cellspacing="0" cellpadding="2" width="100%" height="*"
    class="sortable" style="border: solid 1px #666666;">

    <thead>
    <tr><th><span title="Click to sort by Item">#</span></th><th><span
    title="Click to sort by Date">Date</span></th><th><span title="Click to sort
    by Description">Description</span></th><th><span title="Click to sort by
    Supplier">Supplier</span></th><th><span title="Click to sort by
    Sponsor">Sponsor</span></th><th><span title="Click to sort by
    Cost">Cost</span></th></tr>
    </thead>

    <tbody>

    <tr>
    <td>1</td>
    <td>2010-05-11</td>
    <td><a href="http://tidd.ly/e4e956f5" class="costs" target="_blank"
    title="Click form more information about Lawn Shears" hidefocus>Lawn
    Shears</a></td>
    <td><a href="http://www.awin1.com/awclick.php?mid=483&id=117914"
    class="costs" target="_blank" title="Click to visit the B&amp;Q website"
    hidefocus>B&amp;Q</a></td>
    <td>&nbsp;</td>
    <td align="right">&pound;29.98</td>
    </tr>

    <tr>
    <td>2</td>
    <td>2010-05-11</td>
    <td><a href="http://tidd.ly/525c9894" class="costs" target="_blank"
    title="Click form more information about Work Gloves" hidefocus>Work
    Gloves</a></td>
    <td><a href="http://www.awin1.com/awclick.php?mid=483&id=117914"
    class="costs" target="_blank" title="Click to visit the B&amp;Q website"
    hidefocus>B&amp;Q</a></td>
    <td>&nbsp;</td>
    <td align="right">&pound;3.98</td>
    </tr>

    </tbody>

    </table>


    Hope this helps

    Andy
     
    Andy, Jun 28, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,137
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Replies:
    2
    Views:
    1,441
    James Kanze
    Jul 6, 2010
  3. Jason
    Replies:
    0
    Views:
    390
    Jason
    Oct 4, 2006
  4. Tom Kirchner

    sorting by multiple criterias (sub-sorting)

    Tom Kirchner, Oct 11, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    476
    Michael Budash
    Oct 11, 2003
  5. Íéêüëáïò Êïýñáò

    Sorting a set works, sorting a dictionary fails ?

    Íéêüëáïò Êïýñáò, Jun 10, 2013, in forum: Python
    Replies:
    12
    Views:
    161
    Ulrich Eckhardt
    Jun 10, 2013
Loading...

Share This Page