From 3b912bfe17c9788b28d7d13e5dc64d085eeea07f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 23 Jan 2011 00:39:02 +0530 Subject: [PATCH] api sort, webkit likes 1/0/-1 --- static/js/pandora.api.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/static/js/pandora.api.js b/static/js/pandora.api.js index 69bb45b8..8eddbd3d 100755 --- a/static/js/pandora.api.js +++ b/static/js/pandora.api.js @@ -66,11 +66,18 @@ function constructList() { columnsRemovable: false, id: 'actionList', request: function(data, callback) { + function _sort(a, b) { + if(a.name > b.name) + return 1; + else if(a.name == b.name) + return 0; + return -1; + } if(!data.keys) { app.api.api(function(results) { var items = []; $.each(results.data.actions, function(i, k) {items.push({'name': i})}); - items = items.sort(function(a, b) { return a.name > b.name; }); + items.sort(_sort); var result = {'data': {'items': items.length}}; callback(result); }); @@ -78,7 +85,7 @@ function constructList() { app.api.api(function(results) { var items = []; $.each(results.data.actions, function(i, k) {items.push({'name': i})}); - items = items.sort(function(a, b) { return a.name > b.name; }); + items.sort(_sort); var result = {'data': {'items': items}}; callback(result); });