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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-01-30 15:51:50 +01:00
parent 1d5e523aa0
commit 149851638d

View File

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