cancel
Showing results for 
Search instead for 
Did you mean: 

Formatter function not work in XML Fragment

Former Member
0 Kudos

Hi all,

I'm not getting to make the following formatter function work:

MyApp/models.Formatter.js

sap.ui.define([], function () {
	"use strict";
	return {
		formatPO: function (sEbeln, sEbelp) {
			console.log("calling...");
			return sEbeln + "/" + sEbelp;
		}
	};
});

MyApp/controller/Master.controller.js

sap.ui.define([
	"sap/ui/core/mvc/Controller",
	"sap/m/MessageBox",
	"sap/m/MessageToast",
	"MyApp/functions/Functions",
	"MyApp/models/Formatter"
], function (Controller, MessageBox, MessageToast, Functions, formatter) {
	"use strict"; 
	return Controller.extend("MyApp.controller.Master", {
		formatter: formatter,	

MyApp/fragments/ListaPO.fragment.xml

<ObjectIdentifier
    title="{ parts:[{path: 'mdlOpenPO>Ebeln'}, 
                    {path: 'mdlOpenPO>Ebelp'}],
             formatter: '.formatter.formatPO' }" 
    text="{mdlOpenPO>Txz01}"/>

MyApp/view/Master.view.xml

	<Page title="{i18n>masterTitle}" level="H1">
		<content>
			<core:Fragment fragmentName="MyApp.fragments.ListaPO" type="XML"/>
		</content>
	</Page>

Does not return any errors, simply does not work.

Does anybody could help me to find the cause of this issue?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Thanks for the answer. I solved the problem by inserting the following line code in bootstrap:

data-sap-ui-xx-bindingSyntax="complex"

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos
<core:Fragment fragmentName="MyApp.fragments.ListaPO" type="XML" oController="yourcontroller"/>

not sure if it will work.