Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Table sorting

Reply
Thread Tools

Re: Table sorting

 
 
Andy
Guest
Posts: n/a
 
      06-28-2013
"Ed Mullen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/mygardenpr...s/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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting list vs sorting vector boltar2003@boltar.world C++ 2 07-06-2010 09:40 AM
fired event Sorting which wasn't handled - sorting and SelectedIndexChanged Jason ASP .Net Web Controls 0 10-04-2006 02:19 PM
Table/table rows/table data tag question? Rio HTML 4 11-05-2004 08:11 AM
sorting by multiple criterias (sub-sorting) Tom Kirchner Perl Misc 3 10-11-2003 05:16 PM
Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table. David Williams ASP .Net 2 08-12-2003 07:55 AM



Advertisments