diff --git a/deluge/ui/web/js/Deluge.Torrents.js b/deluge/ui/web/js/Deluge.Torrents.js index eead22a23..6968d2261 100644 --- a/deluge/ui/web/js/Deluge.Torrents.js +++ b/deluge/ui/web/js/Deluge.Torrents.js @@ -209,6 +209,8 @@ Copyright: initComponent: function() { Ext.deluge.TorrentGrid.superclass.initComponent.call(this); Deluge.Events.on('torrentRemoved', this.onTorrentRemoved, this); + Deluge.Events.on('logout', this.onDisconnect, this); + this.on('rowcontextmenu', function(grid, rowIndex, e) { e.stopEvent(); var selection = grid.getSelectionModel(); @@ -222,11 +224,11 @@ Copyright: /** * Returns the record representing the torrent at the specified index. * - * @param {int} The row index of the torrent you wish to retrieve. + * @param index {int} The row index of the torrent you wish to retrieve. * @return {Ext.data.Record} The record representing the torrent. */ - getTorrent: function(rowIndex) { - return this.getStore().getAt(rowIndex); + getTorrent: function(index) { + return this.getStore().getAt(index); }, getSelected: function() { @@ -245,6 +247,10 @@ Copyright: } }, + onDisconnect: function() { + this.getStore().removeAll(); + }, + // private onTorrentRemoved: function(torrentIds) { var selModel = this.getSelectionModel();