]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
cbind mixin: also descend in elements with an cbind property
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Jun 2021 06:42:39 +0000 (08:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Jun 2021 06:42:44 +0000 (08:42 +0200)
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.lamprecht@proxmox.com>
src/mixin/CBind.js

index afef53aadc7a60645788d2d02c54f5b935e90e71..8b4153c33e3d6516f700515b4b375f1cc6c6b85b 100644 (file)
@@ -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) {