[open-ils-commits] r11395 - branches/rel_1_4/Open-ILS/web/js/dojo/openils
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 3 16:41:39 EST 2008
Author: erickson
Date: 2008-12-03 16:41:34 -0500 (Wed, 03 Dec 2008)
New Revision: 11395
Modified:
branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
Log:
added generic sort routine for objects / fm-objects. defaults to sorting on the "id" column
Modified: branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js 2008-12-03 21:41:10 UTC (rev 11394)
+++ branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js 2008-12-03 21:41:34 UTC (rev 11395)
@@ -166,4 +166,16 @@
node.className = className;
}
+ openils.Util.objectSort = function(list, field) {
+ if(dojo.isArray(list)) {
+ if(!field) field = 'id';
+ return list.sort(
+ function(a, b) {
+ if(a[field]() > b[field]()) return 1;
+ return -1;
+ }
+ );
+ }
+ return [];
+ };
}
More information about the open-ils-commits
mailing list