This article is mainly on the JS two-dimensional array sorting Simple sample code is introduced, the need for friends can come to the reference, I hope to help you.
As follows: code is as follows: <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > <html> & nbsp;<head> <title> New Document </title> <meta name= "generator" content= "EditPlus" & Gt <meta name= "Author" content= "> <meta name=" Keywords "content=" "> <meta name=" Description "content=" "> <script type=" Text/javascript "> <!-- function Getcard (M { var ret = [], rnd; for (var i = 0; i < m; i++) { &NBSP;RND = Math.floor (Math.random () * (i+0. 9999)); ret[i] = ret[rnd]; &NBSP;RET[RND] = i } return ret; &NBSP} var data = []; { for (var i = 0; i < i + +) { data.push (getcard); } } //two-dimensional data ordering &NB Sp;function mysort (Array, col, Ord, B, e) { if (array.length = 0) return; //document.write ("Pre-sorted" +array); &nbSp var t = [], S, i, Curcol = col[0]; for (i = b; i < E; i + +) { s = new String (Array[i][curcol]); s._obj = Array[i]; & Nbsp;t.push (s) } T.sort (); if (ord[0] = = "Des") { t.reverse (); } for (i = 0; i < e-b; i++) { //docume Nt.write ("<br/>"); //document.write (Array[i]); //document.write ("<br/>"); //document.write (t[i]._obj); //document.write ("<br/>"); //document.write (T[i]._obj = = Array[b+i]); array[b+i] = t[i]._obj; } //document.write ("sorted after ====================<br/>") //print (array); VAR begin, end; if (Col.length > 1) { col.shift (); ord.shift (); begin = b; for (i = b; i < e-b-1; i++) { if (Array[i][curcol]!= Array[i+1][curcol]) { end = i+1; //document.write ("begin=" +begin+ "end=" +end+ "<br/>"); mysort (array,col,ord,begin,end); begin = end; } &NBSP} if (begin!= E) { mysort (array,col,ord,begin,e); } &N Bsp } //document.write ("<br/>"); //document.write ("sort after" +array); &NBSP} function Print (data) { for (var i = 0; i < data.length; i++) { document.write (data[i]+ "& Lt;br/> "); }  } document.write ("====================<br/> before sorting"); print (data); var B = new Date (). GetTime ();; mysort (data, [0,1,2],[' ASC ', ' des ', ' ASC '],0,data.length); document.write ("spents" + (new Date ()). GetTime ()-B)); document.write ("sorted after ====================<br/>") print (data); //--> </script> </head> <body> </body> </ Html>