[pve-devel] [PATCH widget-toolkit 2/4] node/Tasks: deselect entries when filter changes

Dominik Csapak d.csapak at proxmox.com
Mon Jul 5 16:34:00 CEST 2021


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 at proxmox.com>
---
 src/node/Tasks.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/node/Tasks.js b/src/node/Tasks.js
index 0c5b79a..d93111b 100644
--- a/src/node/Tasks.js
+++ b/src/node/Tasks.js
@@ -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',
 		},
 	    },
 	},
-- 
2.30.2






More information about the pve-devel mailing list