Author: jfthomps
Date: Fri May 27 15:09:34 2011
New Revision: 1128350

URL: http://svn.apache.org/viewvc?rev=1128350&view=rev
Log:
added ignoreCaseSort and use it with the sort in sortSelect

Modified:
    incubator/vcl/trunk/web/js/code.js

Modified: incubator/vcl/trunk/web/js/code.js
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/code.js?rev=1128350&r1=1128349&r2=1128350&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/code.js (original)
+++ incubator/vcl/trunk/web/js/code.js Fri May 27 15:09:34 2011
@@ -280,13 +280,23 @@ function sortSelect(selobj) {
                values[selobj.options[i].text] = selobj.options[i].value;
                texts[i] = selobj.options[i].text;
        }
-       texts.sort();
+       texts.sort(ignoreCaseSort);
        for(var i = 0; i < selobj.options.length; i++) {
                selobj.options[i].text = texts[i];
                selobj.options[i].value = values[texts[i]];
        }
 }
 
+function ignoreCaseSort(a, b) {
+       a = a.toLowerCase();
+       b = b.toLowerCase();
+       if(a > b)
+               return 1;
+       if(a < b)
+               return -1;
+       return 0;
+}
+
 function getSelectText(objid) {
        if(dijit.byId(objid))
                return dijit.byId(objid).textbox.value;


Reply via email to