Hi experts,
am new in using formatters,
i need to get value in percentage Example : 1600,1500 vales are there i need to get percentage value so 1600%1500*100 =106.6%
View.xml
<mvc:View controllerName="Formatter.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<List headerText="Information" items="{path: '/results'}">
<CustomListItem>
<VBox class="sapUiSmallMarginBegin sapUiSmallMarginTopBottom">
<HBox>
<Label text="Sales"/>
<Text text="{Sales}"/>
</HBox>
<HBox>
<Label text="Goal"/>
<Text text="{goal}"/>
</HBox>
<HBox>
<Label text="Percentage"/>
<!--<Text text="{parts: [{ path: '{Sales'},{ path: '{goal}'] formatter: 'formatter' }"/>-->
</HBox>
</VBox>
</CustomListItem>
</List>
</content>
</Page>
</pages>
</App>
</mvc:View>
formatter.js
sap.ui.define([], function () {
"use strict";
return {
calculation: function (a,b) {
return a*b%100;
},
};
});
controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller",
'sap/ui/model/json/JSONModel',
], function(Controller, JSONModel) {
"use strict";
return Controller.extend("Formatter.controller.View1", {
onInit: function() {
var oModel = new JSONModel(jQuery.sap.getModulePath("Formatter.model", "/madhu.json"));
this.getView().setModel(oModel);
},
});
});
Please help,
Thanks in advance