On 24.06.21 17:11, Dominik Csapak wrote:
> currently, cbind only applies properties on objects which have
> an 'xtype' property.
> 
> commit 38e6634a8fe8c11ec23e555ce55bc1972ccb5ea1
> removed those, thinking the xtype in the 'defaults' is enough
> 
> add them back, noting that cbind does need it, to prevent removal
> 
> Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
> ---
> we should probably cherry-pick it into stable-6 as well
> 

would have worked but I ran into such issues a few times already during 
development,
so after our off-list discussion and checking out my git stash I found a fix 
for cbind
itself I had lying around for a bit, so I applied that instead as it should 
make this
easier/more flexible in general

Thanks nonetheless for the quick fix.

----8<----
>From 5995eddcc48ddb63d235905cd0a948f38c5e9164 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <t.lampre...@proxmox.com>
Date: Fri, 25 Jun 2021 08:42:39 +0200
Subject: [PATCH] cbind mixin: also descend in elements with an cbind property

Not only into those with an xtype one, as we can either have a
implicit default xtype (e.g., in tbars for buttons, or set explicitly
via the `defaults` mechanism) or want to apply cbinds to stores or
other objects.

Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com>
---
 src/mixin/CBind.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mixin/CBind.js b/src/mixin/CBind.js
index afef53a..8b4153c 100644
--- a/src/mixin/CBind.js
+++ b/src/mixin/CBind.js
@@ -88,7 +88,7 @@ Ext.define('Proxmox.Mixin.CBind', {
            found = false;
            for (i = 0; i < arrayLength; i++) {
                el = org[i];
-               if (el.constructor === Object && el.xtype) {
+               if (el.constructor === Object && (el.xtype || el.cbind)) {
                    found = true;
                    break;
                }
@@ -99,7 +99,7 @@ Ext.define('Proxmox.Mixin.CBind', {
            copy = [];
            for (i = 0; i < arrayLength; i++) {
                el = org[i];
-               if (el.constructor === Object && el.xtype) {
+               if (el.constructor === Object && (el.xtype || el.cbind)) {
                    elcopy = cloneTemplateObject(el);
                    if (elcopy.cbind) {
                        applyCBind(elcopy);
@@ -123,7 +123,7 @@ Ext.define('Proxmox.Mixin.CBind', {
                    res[prop] = el;
                    continue;
                }
-               if (el.constructor === Object && el.xtype) {
+               if (el.constructor === Object && (el.xtype || el.cbind)) {
                    copy = cloneTemplateObject(el);
                    if (copy.cbind) {
                        applyCBind(copy);
@@ -146,7 +146,7 @@ Ext.define('Proxmox.Mixin.CBind', {
                el = me[prop];
                if (el === undefined || el === null) continue;
                if (typeof el === 'object' && el.constructor === Object) {
-                   if (el.xtype && prop !== 'config') {
+                   if ((el.xtype || el.cbind) && prop !== 'config') {
                        me[prop] = cloneTemplateObject(el);
                    }
                } else if (el.constructor === Array) {
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to