mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-05 10:29:22 +00:00
quarantine list: factor out restoreSavedSelection
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
0e26e20aa5
commit
9b4247fbf2
@ -80,15 +80,8 @@ Ext.define('PMG.QuarantineList', {
|
||||
// to keep the selection, but we do not care for that on a new load anyway
|
||||
view.getSelectionModel().deselectAll();
|
||||
|
||||
store.load(function() {
|
||||
if (me.savedPosition !== undefined) {
|
||||
if (store.getCount() - 1 < me.savedPosition) {
|
||||
me.savedPosition = store.getCount() - 1;
|
||||
}
|
||||
view.setSelection(store.getAt(me.savedPosition));
|
||||
} else {
|
||||
view.setSelection();
|
||||
}
|
||||
store.load(() => {
|
||||
me.restoreSavedSelection();
|
||||
if (Ext.isFunction(callback)) {
|
||||
callback();
|
||||
}
|
||||
@ -96,6 +89,20 @@ Ext.define('PMG.QuarantineList', {
|
||||
});
|
||||
},
|
||||
|
||||
restoreSavedSelection: function() {
|
||||
let me = this;
|
||||
let view = me.getView();
|
||||
if (me.savedPosition !== undefined) {
|
||||
let store = view.getStore();
|
||||
if (store.getCount() - 1 < me.savedPosition) {
|
||||
me.savedPosition = store.getCount() - 1;
|
||||
}
|
||||
view.setSelection(store.getAt(me.savedPosition));
|
||||
} else {
|
||||
view.setSelection();
|
||||
}
|
||||
},
|
||||
|
||||
setFrom: function(from) {
|
||||
let view = this.getView();
|
||||
let params = view.getStore().getProxy().getExtraParams();
|
||||
|
Loading…
Reference in New Issue
Block a user