Current location: Hot Scripts Forums » General Web Coding » JavaScript » need help in sorting table


need help in sorting table

Reply
  #1 (permalink)  
Old 03-16-04, 05:37 AM
niyax niyax is offline
New Member
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy need help in sorting table

i have this table with 2 columns

1st column::has a image of a book and a price
2nd columns::has the title of book, some detail abt the book nd the authors name

here is wat i m trying to do.. i want to be able to sort the table according to the price, title nd authors name.

I hav found many scripts for sorting table but cant get any of them to work with my table mainly because the way the details are distributed in my table.. but its really not possible for me to insert any new columns..nd desparately need a way to sort the table..some help please .

here is how my table is:

Code:
<table width="100%" border="0" cellpadding="0" cellspacing="0" id=dataTable>
	<tr> 
 		<td width="14%" height="149" align="center" valign="middle"> 
		  <img src="biogra/TisHerself.gif" height="90" width="68">
		  <br>Our Price: <font color="#FF0000">$17.50</font>
		</td>		                        
        <td width="86%" valign="middle"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
          <strong>Title:<a href="#">'Tis Herself</a></strong>
		  <br>An exquisite Irish beauty whose film career has spanned<br>
          <em>Author:<font color="#FF0000">Maureen O'Hara</font></em></font> 
        </td>
	</tr>
	<tr> 
		<td width="14%" height="149" align="center" valign="middle"> 
          <img src="biogra/DebraGinsberg.gif" height="90" width="68">
		  <br>Our Price: <font color="#FF0000">$16.76</font></p>
		</td>		                        
        <td width="86%" valign="middle"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
           <strong>Title:<a href="#">About My Sisters</a></strong>
		   <br>Chronicling a year in the life of her close-knit clan
		   <br><em>Author:<font color="#FF0000">Debra Ginsberg</font></em></font>
		</td>
	</tr>
</table>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-24-04, 04:39 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
How is the table generated? Are you using a server-side script or is it just a static HTML page?

If it's pure HTML it will be a bit harder since you'll need a script which reads the data in the table, stores it in arrays or objects, sorts it, and prints it out again on the page.

An alternative is to store the data in arrays from the beginning and then print it out on the page in a default order, then you just select a new order from a dropdown-list or whatever and the arrays are sorted and reprinted. This method will probably be the most flexible and you can change the layout of the site w/o having to rewrite the routine which reads the data from the HTML (since such a routine isn't needed)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto table resize derick_2k JavaScript 4 04-26-04 03:32 PM
select timestamp that doesn't exist in other table jove PHP 0 03-12-04 09:40 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 05:28 PM
strange grey "extra" table area... skyraider HTML/XHTML/XML 1 12-10-03 11:55 PM
moving data from table to table ..please help! geneane ASP 2 09-22-03 08:02 PM


All times are GMT -5. The time now is 06:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.