HTML
  Home arrow HTML arrow Page 4 - 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 - The titleBoolArr Array


    (Page 4 of 4 )

    This is a JavaScript two-dimensional array having two columns. The first column holds the titles (ID, Name, etc); the second holds the corresponding indices. The second column holds either a “true” or a “false” value, which indicates whether the corresponding column is sorted. The titles have been written in such a way that the recordset column indices are the corresponding row indices of the titleBoolArr array. This is the construction of the array and initialization:


    var titleBoolArr = new Array(6)

    for (i=0; i < 6; i++)

    {

    titleBoolArr[i] = new Array(2);

    }


    //initialize the array

    titleBoolArr[0][0] = "ID"; titleBoolArr[0][1] = "false";

    titleBoolArr[1][0] = "Name"; titleBoolArr[1][1] = "false";

    titleBoolArr[2][0] = "Department"; titleBoolArr[2][1] = "false";

    titleBoolArr[3][0] = "Job"; titleBoolArr[3][1] = "false";

    titleBoolArr[4][0] = "Years"; titleBoolArr[4][1] = "false";

    titleBoolArr[5][0] = "Salary"; titleBoolArr[5][1] = "false";


    First a one-dimensional array is created with the line:


    var titleBoolArr = new Array(6)


    Next, each element of the array is made an array by the “for” loop. The two dimensional array is actually an array of arrays. JavaScript does not have a single statement for creating a two dimensional array.

    The setTitleBool() Function

    After sorting, this function indicates that a particular column has been sorted by setting the Boolean value for the column to “true” in the titleBoolArr array. It also indicates that no other column is sorted by setting all the other Boolean values to “false”. This is the function:


    function setTitleBool(theTitle)

    {

    for (i=0; i<6; i++)

    {

    if (titleBoolArr[i][0] == theTitle)

    titleBoolArr[i][1] = "true";

    else

    titleBoolArr[i][1] = "false";

    }

    }


    We shall continue in the next part of the series.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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 6 Hosted by Hostway
    Stay green...Green IT