load the trackers into the grid

This commit is contained in:
Damien Churchill 2009-05-05 19:29:04 +00:00
commit 83ff72490c
2 changed files with 18 additions and 3 deletions

View file

@ -46,12 +46,14 @@ Ext.deluge.EditTrackers = Ext.extend(Ext.Window, {
this.addButton(_('Cancel'), this.onCancel, this); this.addButton(_('Cancel'), this.onCancel, this);
this.addButton(_('Ok'), this.onOk, this); this.addButton(_('Ok'), this.onOk, this);
this.on('show', this.onShow, this);
this.grid = this.add({ this.grid = this.add({
xtype: 'grid', xtype: 'grid',
store: new Ext.data.SimpleStore({ store: new Ext.data.SimpleStore({
fields: [ fields: [
{name: 'tier', mapping: 0}, {name: 'tier', mapping: 0},
{name: 'tracker', mapping: 1} {name: 'url', mapping: 1}
] ]
}), }),
columns: [{ columns: [{
@ -65,7 +67,7 @@ Ext.deluge.EditTrackers = Ext.extend(Ext.Window, {
header: _('Tracker'), header: _('Tracker'),
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'tracker' dataIndex: 'url'
}], }],
stripeRows: true, stripeRows: true,
selModel: new Ext.grid.RowSelectionModel({ selModel: new Ext.grid.RowSelectionModel({
@ -126,7 +128,20 @@ Ext.deluge.EditTrackers = Ext.extend(Ext.Window, {
this.hide(); this.hide();
}, },
onRequestComplete: function(status) {
var trackers = [];
Ext.each(status['trackers'], function(tracker) {
trackers.push([tracker['tier'], tracker['url']]);
});
this.grid.getStore().loadData(trackers);
},
onShow: function() { onShow: function() {
var r = Deluge.Torrents.getSelected();
Deluge.Client.core.get_torrent_status(r.id, ['trackers'], {
success: this.onRequestComplete,
scope: this
});
} }
}); });
Deluge.EditTrackers = new Ext.deluge.EditTrackers(); Deluge.EditTrackers = new Ext.deluge.EditTrackers();

File diff suppressed because one or more lines are too long