stop the torrent grid from resetting its position upon update

This commit is contained in:
Damien Churchill 2010-01-29 11:04:26 +00:00
parent 1d29f67a75
commit 343521ca25
1 changed files with 12 additions and 3 deletions

View File

@ -235,6 +235,10 @@ Copyright:
return this.getStore().getAt(index);
},
/**
* Returns the currently selected records.
* @ return {Array/Ext.data.Record} The record(s) representing the rows
*/
getSelected: function() {
return this.getSelectionModel().getSelected();
},
@ -243,11 +247,16 @@ Copyright:
return this.getSelectionModel().getSelections();
},
update: function(torrents, bulk) {
var store = this.getStore();
store.loadData({"torrents": Ext.values(torrents)});
update: function(torrents) {
// NOTE: this isn't published in the API docs so may disappear unexpectedly
// when upgrading Ext Js.
var scroller = this.getView().scroller.dom;
var scrollTop = scroller.scrollTop;
this.getStore().loadData({"torrents": Ext.values(torrents)});
scroller.scrollTop = scrollTop;
},
// private
onDisconnect: function() {
this.getStore().removeAll();
},