From 149851638d0c629c027fc6077b1af2c2cb93f7ac Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 30 Jan 2020 15:51:50 +0100 Subject: [PATCH] cbind: allow to pass "formula" function in binding can often ve useful and doesn't hurts, somewhat similar to ExtJS forumlas in viemodels, but inline. Signed-off-by: Thomas Lamprecht --- mixin/CBind.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mixin/CBind.js b/mixin/CBind.js index 2d0a3ee..e00c7b8 100644 --- a/mixin/CBind.js +++ b/mixin/CBind.js @@ -37,7 +37,10 @@ Ext.define('Proxmox.Mixin.CBind', { cdata = cbind[prop]; found = false; - if (match = /^\{(!)?([a-z_][a-z0-9_]*)\}$/i.exec(cdata)) { + if (typeof cdata === 'function') { + obj[prop] = cdata(getConfigValue, prop); + found = true; + } else if (match = /^\{(!)?([a-z_][a-z0-9_]*)\}$/i.exec(cdata)) { var cvalue = getConfigValue(match[2]); if (match[1]) cvalue = !cvalue; obj[prop] = cvalue;