Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2010, 01:06 AM
Authorized User
 
Join Date: Jan 2010
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sorting and fixed Table Headers in HTML Table..Urgent help!!

Hi


Can anyone tell me how to add Sorting and fixed Table Headers to an HTML Table?
 
Old February 7th, 2010, 04:04 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Would help to define what you mean. What is a "Fixed Table Header" in your mind?

And do you mean you want the capability to sort the rows of a <table> based on the user clicking on one of the column headers? If so, *how* will you do the sorting? Will you use JavaScript in the browser or will you sort on the backend, using ASP/PHP/JSP/whatever?
 
Old February 7th, 2010, 05:46 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

You can't sort an *HTML* table. It simply doesn't support that function. The easiest and fastest way to add sorting to a table is by using an ASP.NET GridView.

As Old Pedant says, you can also perform sorting client side using Javascript but that will mean that your application won't work for a significant cross section of your visitors. However, if you don't mind losing a small but significant percentage of your visitors, and *this sounds like the deal breaker for you* IF you have the time to custom program a javascript sorting application, it would offload the work client side and improve application scalability.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old February 8th, 2010, 05:17 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Sorry, chroniclemaster, I have to disagree with you. You can sort an HTML table, using JavaScript. Mind you, I don't think its the best idea, but it can be done.
 
Old February 8th, 2010, 06:38 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
Originally Posted by Old Pedant View Post
Sorry, chroniclemaster, I have to disagree with you. You can sort an HTML table, using JavaScript. Mind you, I don't think its the best idea, but it can be done.
Agreed. :) I'm sorry, I thought I had said as much, but I simply meant that *HTML* cannot provide sorting. I was trying to direct him to the ASP.NET or Javascript forums; my fault for merely implying rather than explicitly saying you can get better assistance at one of the other topics.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old September 17th, 2010, 05:59 AM
Registered User
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bhagwan
Thumbs up table help

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
<title>Classic Movies Times</title>
</head>

<body>
<table border="1" width="500">
<caption>Classic Movie Day</caption>
<tr>
<th></th>
<th width="200">5 pm</th>
<th width="200">7 pm</th>
<th width="200">9 pm</th>
<th width="200">11 pm</th>
</tr>
<tr>
<th>Screen one</th>
<td>Star Wars</td>
<td>Empire Strikes Back</td>
<td>Return of the Jedi</td>
<td>The Exorcist</td>
</tr>
<tr>
<th>Screen two</th>
<td colspan="2">Dances with Wolves</td>
<td colspan="2">Gone With the Wind</td>
</tr>
<tr>
<th>Screen three</th>
<td colspan="2">2001: A Space Odyssey</td>
<td>The Conversation</td>
<td>5 Easy Pieces</td>
</tr>
</table>

</body>
</html>

Don't forgot to thanx me
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
very urgent:cals table to indesign table using xsl franklinclinton XSLT 1 December 16th, 2009 03:48 PM
Fixed table columns darkhalf HTML Code Clinic 1 August 27th, 2008 02:05 AM
Transform html table to add ids/headers using xsl kapy_kal XSLT 2 February 21st, 2007 10:12 AM
Fixed size table amc Dreamweaver (all versions) 4 August 29th, 2004 07:03 AM
XML to HTML Table with Sorting and Distinct VictorMk XSLT 4 April 23rd, 2004 06:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.