button: make xtype of parent configurable

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-06-04 12:32:02 +02:00 committed by Thomas Lamprecht
parent 8617feb8fc
commit 335b5f3747

View File

@ -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;
}
}