mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-28 04:04:47 +00:00
add a custom sorter for the address column
This commit is contained in:
parent
0ac64da5c6
commit
01350e0060
@ -244,10 +244,22 @@ function peer_progress(value) {
|
|||||||
return String.format(tpl, progress, '', progress);
|
return String.format(tpl, progress, '', progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sort_address(value) {
|
||||||
|
var m = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);
|
||||||
|
var address = 0;
|
||||||
|
var parts = [m[1], m[2], m[3], m[4]];
|
||||||
|
$each(parts, function(part, index) {
|
||||||
|
part = parseInt(part);
|
||||||
|
address = address | part << ((3 - index) * 8);
|
||||||
|
alert("Total: " + address + "\nPart: " + part + "\nIndex: " + index + "\nCalc: " + (part << ((3 - index) * 8)));
|
||||||
|
});
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
Deluge.Details.Peers.Store = new Ext.data.SimpleStore({
|
Deluge.Details.Peers.Store = new Ext.data.SimpleStore({
|
||||||
fields: [
|
fields: [
|
||||||
{name: 'country'},
|
{name: 'country'},
|
||||||
{name: 'address'},
|
{name: 'address', sortType: sort_address},
|
||||||
{name: 'client'},
|
{name: 'client'},
|
||||||
{name: 'progress', type: 'float'},
|
{name: 'progress', type: 'float'},
|
||||||
{name: 'downspeed', type: 'int'},
|
{name: 'downspeed', type: 'int'},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user