mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-06 17:14:45 +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,8 +80,20 @@ Ext.define('PMG.QuarantineList', {
|
|||||||
// to keep the selection, but we do not care for that on a new load anyway
|
// to keep the selection, but we do not care for that on a new load anyway
|
||||||
view.getSelectionModel().deselectAll();
|
view.getSelectionModel().deselectAll();
|
||||||
|
|
||||||
store.load(function() {
|
store.load(() => {
|
||||||
|
me.restoreSavedSelection();
|
||||||
|
if (Ext.isFunction(callback)) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
me.allowPositionSave = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
restoreSavedSelection: function() {
|
||||||
|
let me = this;
|
||||||
|
let view = me.getView();
|
||||||
if (me.savedPosition !== undefined) {
|
if (me.savedPosition !== undefined) {
|
||||||
|
let store = view.getStore();
|
||||||
if (store.getCount() - 1 < me.savedPosition) {
|
if (store.getCount() - 1 < me.savedPosition) {
|
||||||
me.savedPosition = store.getCount() - 1;
|
me.savedPosition = store.getCount() - 1;
|
||||||
}
|
}
|
||||||
@ -89,11 +101,6 @@ Ext.define('PMG.QuarantineList', {
|
|||||||
} else {
|
} else {
|
||||||
view.setSelection();
|
view.setSelection();
|
||||||
}
|
}
|
||||||
if (Ext.isFunction(callback)) {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
me.allowPositionSave = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setFrom: function(from) {
|
setFrom: function(from) {
|
||||||
|
Loading…
Reference in New Issue
Block a user