api sort, webkit likes 1/0/-1
This commit is contained in:
parent
5500ea7bc4
commit
3b912bfe17
1 changed files with 9 additions and 2 deletions
|
@ -66,11 +66,18 @@ function constructList() {
|
||||||
columnsRemovable: false,
|
columnsRemovable: false,
|
||||||
id: 'actionList',
|
id: 'actionList',
|
||||||
request: function(data, callback) {
|
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) {
|
if(!data.keys) {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(results.data.actions, function(i, k) {items.push({'name': i})});
|
$.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}};
|
var result = {'data': {'items': items.length}};
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
|
@ -78,7 +85,7 @@ function constructList() {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(results.data.actions, function(i, k) {items.push({'name': i})});
|
$.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}};
|
var result = {'data': {'items': items}};
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue