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.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-06-25 08:42:39 +02:00
parent f5853d4605
commit 5995eddcc4

View File

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