api sort, webkit likes 1/0/-1
This commit is contained in:
parent
b3ebc848fb
commit
77e9b0cf90
1 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue