Text string as params in a formatter function

2019-09-15 11:41发布

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

Something like this:

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

This is the dual Question of Use custom global function in Expression Binding

2条回答
看我几分像从前
2楼-- · 2019-09-15 12:23

In myFunction(sVal) -> sVal will be holding your string which you have passed in your XML view for path

Custom Formatter

查看更多
Root(大扎)
3楼-- · 2019-09-15 12:44

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.

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.

查看更多
登录 后发表回答