add a helper methods to torrents
trigger an update immediately when the torrent is changed in the grid
This commit is contained in:
parent
a9fb98c23a
commit
4e5e98d90b
|
@ -1,4 +1,23 @@
|
|||
Deluge.Details = {}
|
||||
Deluge.Details = {
|
||||
|
||||
update: function() {
|
||||
var torrent = Deluge.Torrents.getSelected();
|
||||
if (!torrent) return;
|
||||
|
||||
var tab = this.Panel.getActiveTab();
|
||||
if (tab.update) {
|
||||
tab.update(torrent.id);
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function(panel) {
|
||||
Deluge.Torrents.Grid.on('rowclick', this.onTorrentsClick.bindWithEvent(this));
|
||||
},
|
||||
|
||||
onTorrentsClick: function(grid, rowIndex, e) {
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
|
||||
Deluge.ProgressBar = Ext.extend(Ext.ProgressBar, {
|
||||
initComponent: function() {
|
||||
|
@ -102,19 +121,7 @@ Deluge.Details.Details = {
|
|||
}
|
||||
}
|
||||
|
||||
$extend(Deluge.Details, {
|
||||
|
||||
update: function() {
|
||||
var torrent = Deluge.Torrents.getSelected();
|
||||
if (!torrent) return;
|
||||
|
||||
var tab = this.Panel.getActiveTab();
|
||||
if (tab.update) {
|
||||
tab.update(torrent.id);
|
||||
}
|
||||
},
|
||||
|
||||
Panel: new Ext.TabPanel({
|
||||
Deluge.Details.Panel = new Ext.TabPanel({
|
||||
region: 'south',
|
||||
split: true,
|
||||
height: 200,
|
||||
|
@ -139,6 +146,6 @@ $extend(Deluge.Details, {
|
|||
},{
|
||||
id: 'options',
|
||||
title: _('Options')
|
||||
}]
|
||||
})
|
||||
}],
|
||||
listeners: {'render': {fn: Deluge.Details.onRender, scope: Deluge.Details}}
|
||||
});
|
|
@ -43,6 +43,10 @@ Deluge.Torrents = {
|
|||
id: 14
|
||||
}),
|
||||
|
||||
getTorrent: function(rowIndex) {
|
||||
return this.Grid.store.getAt(rowIndex);
|
||||
},
|
||||
|
||||
getSelected: function() {
|
||||
return this.Grid.getSelectionModel().getSelected();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue