Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 10th, 2004, 04:29 PM
Registered User
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sorting 2 dimensional array

In JavaScript to sort a single demensional array named 'users' we use the sort method as follows --> users.sort();

Let's say we have a two dimensional array named 'users' with three fields defined as follows,

users[indx] = new Array();
users[indx][0] = name;
users[indx][1] = dept;
users[indx][2] = date;

The default sort for two demensional arrays seems to sort by the first field, ie name. Is it possible to sort by another field, ie dept or date. What is the syntax.

Old February 11th, 2004, 12:04 PM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

Cross post to here.

Old December 2nd, 2006, 10:46 AM
Registered User
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to leoparsd

try this link http://www.breakingpar.com/bkp/home....256C8D00514FA4

if this doesn't open, then just type http://www.breakingpar.com and search with keywords sort array you will see the solution there

Similar Threads
Thread Thread Starter Forum Replies Last Post
using 2 dimensional array Abraham EJB 0 July 17th, 2007 09:27 AM
two-dimensional array Lizane Java Basics 4 May 23rd, 2007 09:35 AM
2 dimensional array trangd Beginning PHP 0 August 18th, 2005 12:37 AM
2 dimensional array venterjo General .NET 2 January 23rd, 2005 09:04 AM
sorting two dimensional array erin VBScript 0 February 10th, 2004 05:55 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.