HTML
  Home arrow HTML arrow Sorting for Database Forms with HTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Sorting for Database Forms with HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-08-13

    Table of Contents:
  • Sorting for Database Forms with HTML
  • The sort() Function continued
  • The getColumnIndex() Function
  • The titleBoolArr Array

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Sorting for Database Forms with HTML


    (Page 1 of 4 )

    Welcome to the sixth part of a fourteen part series detailing how to create database forms in HTML. In this article, we will discuss sorting and its various functions as well as the boolean values that come as a result. Please join us as we tackle these issues.

    Appreciation of Sorting

    When data is retrieved from a database, you can have it sorted by the database engine before you receive it at the client. Sorting, whether done by the database engine at the database server or by the client, is based on one column. That is, one column is sorted alphabetically while the others are not sorted. It can only be this way, since the data exist in rows and a row must always have the same elements. If you exchange the positions of two elements in a column during sorting, you are exchanging their corresponding rows to the same positions as you have done for the elements of the column, otherwise the integrity of each row will not be maintained. So you will hardly see an ascending or descending order in more than one column.

    Now, the data may come from the database sorted (based on a column) or not sorted. Even if it is sorted, you may want to see the data in a different order. You can have a function (JavaScript) that will sort the data in ascending or descending order based on any column. For simplicity, I have considered only sorting in ascending order.

    The sort() Function

    There are different algorithms for sorting an array of strings. Time-critical client applications often use the algorithm called Quicksort, which is very efficient. The application for this article is a time-critical client one, so the function I use is an implementation of the Quicksort algorithm. I wrote an article for www.devarticles.com titled “Quicksort.” In this article, I explain how the Quicksort function operates. You can read the article if you want to know how the function operates. Here, I will simply tell you what you send into the function and what you get out of it.

    When the user clicks the Sort button, the following function is called:


    function sort()

    {

    //display a dialog box that prompts the user for input of title – “Name” is default

    var title = prompt("Enter the Title of the Column for Sorting", "Name");

    if ((title != null)&&(title != ""))

    {

    var titleInx = getColumnIndex(title); //the column index of the recordset

    if (titleInx == 6)

    {

    alert(‘The title does not exist - type with the right case without abbreviation.');

    return;

    }

    quickSort("0", (numberOfRows - 1), titleInx);

    }


    showFirstRow();

    setTitleBool(title); //indicate in the titleBoolArr array that the column with the title is sorted

    }

    More HTML Articles
    More By Chrysanthus Forcha


       · We have gone this far! There can be no turning back.Chrys
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT