[pve-devel] [PATCH widget-toolkit] button: make xtype of parent configurable

Dominik Csapak d.csapak at proxmox.com
Thu Jun 4 12:32:02 CEST 2020


to get the selection model of the parent, we use by default the xtype
'grid', but sometimes we want to use something else (e.g. 'treepanel')

to be flexible we make this configurable

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
we could of course fall back to 'treepanel' directly in the code if thats
preferred

 button/Button.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/button/Button.js b/button/Button.js
index 68c6e98..9b8d66e 100644
--- a/button/Button.js
+++ b/button/Button.js
@@ -20,6 +20,9 @@ Ext.define('Proxmox.button.Button', {
     // take special care in confirm box (select no as default).
     dangerous: false,
 
+    // is used to get the parent container for its selection model
+    parentXType: 'grid',
+
     initComponent: function() {
         var me = this;
 
@@ -65,9 +68,9 @@ Ext.define('Proxmox.button.Button', {
 
 	var grid;
 	if (!me.selModel && me.selModel !== null && me.selModel !== false) {
-	    grid = me.up('grid');
-	    if (grid && grid.selModel) {
-		me.selModel = grid.selModel;
+	    parent = me.up(me.parentXType);
+	    if (parent && parent.selModel) {
+		me.selModel = parent.selModel;
 	    }
 	}
 
-- 
2.20.1





More information about the pve-devel mailing list