]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
node/Tasks: deselect entries when filter changes
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 5 Jul 2021 14:34:00 +0000 (16:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Jul 2021 14:44:37 +0000 (16:44 +0200)
since we use a remotefilter on a bufferedstore, the only event where
we can check if the selected element is still there is the 'refresh'
event. Simply deselect if the seleceted element is not in the store

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/node/Tasks.js

index 0c5b79a76400761cf0ee3f33fb460c0faf61c4bb..d93111bc256a9d6e32aa0714d36024d0c1bc8c03 100644 (file)
@@ -44,6 +44,20 @@ Ext.define('Proxmox.node.Tasks', {
            me.getView().updateLayout();
        },
 
+       refresh: function() {
+           let me = this;
+           let view = me.getView();
+
+           let selection = view.getSelection();
+           let store = me.getViewModel().get('bufferedstore');
+           if (selection && selection.length > 0) {
+               // deselect if selection is not there anymore
+               if (!store.contains(selection[0])) {
+                   view.setSelection(undefined);
+               }
+           }
+       },
+
        sinceChange: function(field, newval) {
            let me = this;
            let vm = me.getViewModel();
@@ -144,6 +158,7 @@ Ext.define('Proxmox.node.Tasks', {
                },
                listeners: {
                    prefetch: 'updateLayout',
+                   refresh: 'refresh',
                },
            },
        },