文本字符串作为格式化程序函数中的参数 [英] Text string as params in a formatter function

查看:40
本文介绍了文本字符串作为格式化程序函数中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我用 xml 代码编写的字符串参数传递给我的格式化程序函数:

I would like pass to my formatter function a string params that i write in xml code:

像这样:

visible="{path: 'this_is_my_custo_param_01_02_03', formatter: 'ui5bp.Formatter.myFunction'}"

这是在表达式绑定中使用自定义全局函数的双重问题

推荐答案

不支持.仅在更新与模型的实际绑定时才调用格式化程序函数.

That is not supported. Formatter functions are only called, when a actual binding to a Model is updated.

此外,您不能将其他文字值传递给格式化程序函数.

Also you cannot pass additional literal values to the formatter function.

通常在 Controller.onInit() 中执行此动态配置.通过 id 访问特定控件或创建一个单独的 viewmodel,将属性绑定到 XMLView 中.

Typically this dynamic configuration is performed in Controller.onInit(). Either by accessing specific controls by id or by creating a separate viewmodel that you bind the properties to in the XMLView.

您可以为每个参数值创建一个自定义格式化程序函数,并让他们使用参数调用您的函数.

You can create a custom formatter function for each parameter value and let them call your function with the parameter.

也许这适用于您的情况?如果没有,请告诉我们更多关于您的意图.

Perhaps that is applicable in your case? If not please tell us more about your intentions.

这篇关于文本字符串作为格式化程序函数中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆