diff --git a/deluge/ui/web/js/deluge-all/Torrents.js b/deluge/ui/web/js/deluge-all/Torrents.js
index 614f2a4d9..af4a64d02 100644
--- a/deluge/ui/web/js/deluge-all/Torrents.js
+++ b/deluge/ui/web/js/deluge-all/Torrents.js
@@ -34,7 +34,7 @@
/* Renderers for the Torrent Grid */
function queueRenderer(value) {
- return (value == 99999) ? '' : value + 1;
+ return (value == -1) ? '' : value + 1;
}
function torrentNameRenderer(value, p, r) {
return String.format('
{1}
', r.data['state'].toLowerCase(), value);
@@ -98,7 +98,7 @@
root: 'torrents',
idProperty: 'id',
fields: [
- {name: 'queue'},
+ {name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition},
{name: 'name'},
{name: 'total_size', type: 'int'},
{name: 'state'},
diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js b/deluge/ui/web/js/deluge-all/data/SortTypes.js
index 6f04bb297..a31306d53 100644
--- a/deluge/ui/web/js/deluge-all/data/SortTypes.js
+++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js
@@ -44,5 +44,9 @@ Deluge.data.SortTypes = {
asIPAddress: function(value) {
var d = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);
return ((((((+d[1])*256)+(+d[2]))*256)+(+d[3]))*256)+(+d[4]);
+ },
+
+ asQueuePosition: function(value) {
+ return (value > -1) ? value : 9999999;
}
}
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index 910a568f9..ad36b8200 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -516,11 +516,6 @@ class WebApi(JSONComponent):
def got_torrents(torrents):
ui_info["torrents"] = torrents
- for id in torrents:
- torrent = torrents[id]
- torrent["id"] = id
- if torrent["queue"] == -1:
- torrent["queue"] = 99999
def on_complete(result):
d.callback(ui_info)