p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   select box/List box alphabetic sort (http://p2p.wrox.com/showthread.php?t=19990)

sasidhar79 October 18th, 2004 01:53 AM

select box/List box alphabetic sort

I have a listbox based navigation "Add", "Add all", "Remove", "Remove all" I have fulfilled these tasks, but my client wants the Sort order of the list box to be based on alphabetic order , on Add or Remove.

Please help me in acheiving this alphabetic sorting.



Snib October 18th, 2004 08:44 PM


When you say listbox, do you mean a <select> box?

-Snib <><
Try new FreshView 0.2!
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)

sasidhar79 October 19th, 2004 01:31 AM


yes, I meant a Select box, any way I have fixed the alphabetic ordering, I got the code from Javascript Defiitive guide by Matt Kruse

thank you



vinod_yadav1919 November 10th, 2004 03:04 AM

Hello Sasidhar
Yes you can sort the List box(selectbox) ,for that you will have to create object ,since in order to sort the Text of List box ,you must have to arrange their values in the proper order.
So it's best choice to create object and do the sorting .

You can use array.sort() method only to sort array elements,since List Box may have different value and text ,so you will have use Custom Object .

Hope You will get the answer.
Cheers :)


All times are GMT -4. The time now is 07:55 PM.

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