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

View File

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