do the sorting on the server
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Dec 2008 14:01:03 +0000 (14:01 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Dec 2008 14:01:03 +0000 (14:01 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11679 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js

index 260cd20..c9feb63 100644 (file)
@@ -92,19 +92,11 @@ var GPT = {
         fieldmapper.standardRequest(
             ['open-ils.pcrud', 'open-ils.pcrud.search.csp.atomic'],
             {   async: true,
-                params: [openils.User.authtoken, {id:{'<':100}}],
+                params: [openils.User.authtoken, {id:{'<':100}}, {order_by:{csp:'id'}}],
                 oncomplete: function(r) {
                     if(list = openils.Util.readResponse(r, false, true)) {
-                        list = list.sort(
-                            function(a, b) {
-                                // why not take this opportunity to do some other stuff? ;)
-                                GPT.penaltyMap[a.id()] = a;
-                                GPT.penaltyMap[b.id()] = b;
-                                if(a.id() > b.id()) 
-                                    return 1;
-                                return -1;
-                            }
-                        );
+                        for(var idx in list)
+                            GPT.penaltyMap[list[idx].id()] = list[idx];
                         GPT.standingPenalties = list;
                         if(onload) onload(list);
                     }