[pve-devel] [PATCH manager 2/2] disable selecting when right clicking in tree

Dominik Csapak d.csapak at proxmox.com
Thu Apr 28 15:24:00 CEST 2016


ext4 would not select a tree item on right click,
ext6 does this, so we have to save which
mousebutton was clicked and react accordingly

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/tree/ResourceTree.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 202a46f..56ccb21 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -357,6 +357,7 @@ Ext.define('PVE.tree.ResourceTree', {
 	sp.on('statechange', statechange);
 
 	Ext.apply(me, {
+	    allowSelection: true,
 	    store: store,
 	    viewConfig: {
 		// note: animate cause problems with applyState
@@ -398,7 +399,16 @@ Ext.define('PVE.tree.ResourceTree', {
 		},
 		destroy: function() {
 		    rstore.un("load", updateTree);
-		}
+		},
+		beforecellmousedown: function (tree, record,item,index,ev) {
+		    // disable selection when right clicking
+		    me.allowSelection = !(event.button === 2);
+		},
+		beforeselect: function (tree, record, index, eopts) {
+		    var allow = !!me.allowSelection;
+		    me.allowSelection = true;
+		    return allow;
+		},
 	    },
 	    setViewFilter: function(view) {
 		me.viewFilter = view;
-- 
2.1.4





More information about the pve-devel mailing list