SAPUI5 formatter function with two parameters

Suppose we have a text field where the value depends on another value, in this case we have to pass the two values in the formatter.

See the example below:

Textfield should be like this:
<Text text=”{ parts : [ ‘var1’, ‘var2’ ], formatter: ‘.formatter.approverName’ }”/>

and the formatter code is:

approverName : function (sPosition, sName) {
	if (sPosition === 'GR Admin') {
		return "Custom";
	}
	return sName;
},

 

Leave a Comment.