Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Website Design/Showcase (http://www.chiefdelphi.com/forums/forumdisplay.php?f=64)
-   -   Sortable table for use on webpages (http://www.chiefdelphi.com/forums/showthread.php?t=38183)

Elgin Clock 17-05-2005 12:34

Sortable table for use on webpages
 
Can anyone point me in the direction of a better sortable table that I can use on a webpage?

I found this one: http://javascriptkit.com/script/script2/sorttable.shtml

While it works for regular text as shown on our website here: http://www.team237.com/members.htm

I would like to use it on my own site but incorporate links in the table, and also images, and sort by the link url, or image name I don't see why this should not work. My thinking is that it should recognize the

The problem I found is that this Java Script based table ignores the sorting of the standard html formatting tags such as:
Code:

<td><a href="http://www.imdb.com/title/tt0098987/" target="_blank"><center>Link</center></a></td>
While it sorts the word "Link" and actually does center it by using the <center> commands, it does not sort the link itself as you click on the top header to sort the columns.. It basically leaves the link in the same place within the table, but moves the word "Link" to Alphabetical order.

This is really irritating.

By the way, the table sort js code depends on an external .js file that came with the table's examples which you have to place in the same root directory as your html file that is using the code.
edit: I'm not to familiar with Javascript, but could my problem be that this external .js file is not defining the html image tags as something to sort??
Just a thought..


Is there any other way to code a sortable table that will recognize the html center and image tags as something to organize as well??
edit: What is used to sort the info on this page?
http://www.chiefdelphi.com/forums/memberlist.php?
Php?? Can that be used with images and links?

This will also be helpful to know for the teams site to link pics to the people's individual names in the future.

dshidler 17-05-2005 13:45

Re: Sortable table for use on webpages
 
Quote:

Originally Posted by Elgin Clock
Can anyone point me in the direction of a better sortable table that I can use on a webpage?

I found this one: http://javascriptkit.com/script/script2/sorttable.shtml

While it works for regular text as shown on our website here: http://www.team237.com/members.htm

I would like to use it on my own site but incorporate links in the table, and also images, and sort by the link url, or image name I don't see why this should not work. My thinking is that it should recognize the

The problem I found is that this Java Script based table ignores the sorting of the standard html formatting tags such as:
Code:

<td><a href="http://www.imdb.com/title/tt0098987/" target="_blank"><center>Link</center></a></td>
While it sorts the word "Link" and actually does center it by using the <center> commands, it does not sort the link itself as you click on the top header to sort the columns.. It basically leaves the link in the same place within the table, but moves the word "Link" to Alphabetical order.

This is really irritating.

By the way, the table sort js code depends on an external .js file that came with the table's examples which you have to place in the same root directory as your html file that is using the code.
edit: I'm not to familiar with Javascript, but could my problem be that this external .js file is not defining the html image tags as something to sort??
Just a thought..


Is there any other way to code a sortable table that will recognize the html center and image tags as something to organize as well??
edit: What is used to sort the info on this page?
http://www.chiefdelphi.com/forums/memberlist.php?
Php?? Can that be used with images and links?

This will also be helpful to know for the teams site to link pics to the people's individual names in the future.

PHP and MySQL is how that page is sorted.. The query to the MySQL database sorts it a certain way then will return it to you in a certain way... for example..
Code:

<?php

//Connect to the DB, you can either include a file that connects for widespread use..
include_once("./DB_Connect.php");

$request = mysql_query("SELECT * FROM `members` SORT BY `name` ASC");

echo '<table... blah blah';
while ($info = mysql_fetch_array($request))
{
  echo '
      <tr>
          <td><a href="./members.php?id=', $info['ID'], '">', $info['name'], '</a></td>
      </tr>'; //echo out member info..
}
 
echo '</table>';

mysql_free_result($request); // Not needed, just used to clear out the memory

?>

Of course that isn't a full example, but it gives you the basic idea of how you could do it with PHP. As far as sorting with HTML/JavaScript i'm not sure how to do it. If you find something that does work, check that it works in other browsers too or else not everyone will see it sorted how you want it. Thats the beauty of PHP and doing everything server-side.. Feel free to ask me any questions you may have.

Dan
Team 999

Mike 22-05-2005 17:09

Re: Sortable table for use on webpages
 
Not sure if you fixed it Elgin, but in case you/anyone else needs an answer. Try using CSS to center the text.
Code:

.center{
text-align: center;
}

Then in your HTML
Code:

<table>
    <tr>
        <td class="center">
            Mike
      </td>
    </tr>
</table>



All times are GMT -5. The time now is 16:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi