+ Reply to Thread
Results 1 to 3 of 3

Thread: Sort Data

  1. #1
    secretply is offline x10Hosting Member secretply is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    50

    Sort Data

    This programming is not a big need for me but it would be convenient for my users. Due to my data being somewhat personal, I will not show the code containing the data but show something similar with some other data (names used are fake). Here's what I have:

    Code:
    <span class="nameheader">Name</span><span class="hoursaccumulatedheader">Hours Accumulated</span><span class="graduationyearheader">Graduation Year</span><span class="contactinformationheader">Contact Information</span>
    The above code generates as my "headers" (centered aligned) and would like to be sorted by alphabetical/numerical order when clicked.

    Code:
    .nameheader {background-color: #FFBA00; border-top: 1px #0000FF solid; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; border-left: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 14px; font-family: Arial;}
    .hoursaccumulatedheader {background-color: #FFBA00; border-top: 1px #0000FF solid; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 14px; font-family: Arial;}
    .graduationyearheader {background-color: #FFBA00; border-top: 1px #0000FF solid; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 14px; font-family: Arial;}
    .contactinformationheader {background-color: #FFBA00; border-top: 1px #0000FF solid; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 14px; font-family: Arial;}
    The above is CSS applied to the span tag.

    Code:
    <span class="namespecial">Lopez, Ken</span><span class="hoursaccumulatedspecial">120</span><span class="graduationyearspecial">2009</span><span class="contactinformationspecial">email@domain.com</span>
    The above code generates as the data entries (alphabetic data left aligned, numeric data center aligned) with a background color of #FBEC5D to show special status in the data.

    Code:
    .namespecial {background-color: #FBEC5D; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; border-left: 1px #0000FF solid; float: left; width: 24.5%; text-align: left; color: #0000FF; font-size: 13px; font-family: Arial;}
    .hoursaccumulatedspecial {background-color: #FBEC5D; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 13px; font-family: Arial;}
    .graduationyearspecial {background-color: #FBEC5D; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 13px; font-family: Arial;}
    .contactinformationspecial {background-color: #FBEC5D; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: left; color: #0000FF; font-size: 13px; font-family: Arial;}
    The above is CSS applied to the span tag.

    Code:
    <span class="nameregular">White, Jennifer</span><span class="hoursaccumulatedregular">950</span><span class="graduationyearregular">2007</span><span class="contactinformationregular">mail@url.net</span>
    The above code generates as the data entries (alphabetic data left aligned, numeric data center aligned) with a background color of #FFFFFF to show regular member status in the data.

    Code:
    .nameregular {background-color: #FFFFFF; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; border-left: 1px #0000FF solid; float: left; width: 24.5%; text-align: left; color: #0000FF; font-size: 13px; font-family: Arial;}
    .hoursaccumulatedregular {background-color: #FFFFFF; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 13px; font-family: Arial;}
    .graduationyearregular {background-color: #FFFFFF; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: center; color: #0000FF; font-size: 13px; font-family: Arial;}
    .contactinformationregular {background-color: #FFFFFF; border-right: 1px #0000FF solid; border-bottom: 1px #0000FF solid; float: left; width: 24.5%; text-align: left; color: #0000FF; font-size: 13px; font-family: Arial;}
    The above is CSS applied to the span tag.

    Table tags might be easier but it messed up the layout of the page if I do it that way. I tried using Google but it shows a whole bunch of code and gives no explanation of what that specific code executes. Thank you very much for any help given.
    Last edited by secretply; 06-13-2009 at 09:30 PM.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Sort Data

    A table is most appropriate as the data is tabular in nature. Structure before layout. The CSS is immaterial for this problem.

    To sort the data, you'll need to do it server side when the page is generated or client side using JS.

    How is the page generated? Is all the data shown on one page, or is it broken up across many pages (like result pages in Google, Amazon, &c.)? Depending on the answers to these questions, the requirements may not be defined well enough.

  3. #3
    secretply is offline x10Hosting Member secretply is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    50

    Re: Sort Data

    Issue Resolved. I was able to find something on Google.

+ Reply to Thread

Similar Threads

  1. [REQ][1000 Credits] mysql data to excel to outlook
    By relisys in forum The Marketplace
    Replies: 12
    Last Post: 08-18-2008, 08:41 AM
  2. 9000+ websites down due to explosion at H1 data center
    By jonathanyaniv in forum Off Topic
    Replies: 15
    Last Post: 06-01-2008, 08:19 PM
  3. HTML help...
    By anuj_web in forum Programming Help
    Replies: 5
    Last Post: 05-08-2008, 11:22 AM
  4. can't add or remove Data Bases
    By ssreddy in forum Free Hosting
    Replies: 2
    Last Post: 01-16-2008, 05:04 AM
  5. pimpriot...
    By Derek in forum Off Topic
    Replies: 4
    Last Post: 02-25-2007, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers