Skip to Content
0
Jan 02, 2016 at 04:55 AM

for me sap.ui.getCore().getMessageManager().registerObject(oView, true); doesnot work

134 Views

Hi,

I have created a view and Registered it to MessageManager . In the view I have a field which is of type currency , but even if I put any data (non numeric ), nor on pressing "Enter" neither on focus shift the error filed is highlighted .

Index.html

===============

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta charset="utf-8">

<title>SAPUI5 Walkthrough</title>

<script

id="sap-ui-bootstrap"

src="/resources/sap-ui-core.js"

data-sap-ui-theme="sap_bluecrystal"

data-sap-ui-libs="sap.m, sap.me"

data-sap-ui-modules="sap.m.library"

data-sap-ui-compatVersion="edge"

data-sap-ui-preload="async"

data-sap-ui-resourceroots='{ "sap.ui.demo.db": "./" }'>

</script>

<script>

sap.ui.getCore().attachInit(function () {

var oModel = new sap.ui.model.json.JSONModel({

firstName : "Subhojit",

lastName : "Saha",

enabled : true,

address : {

street : "Sector 55",

city : "Gurgaon",

zip : "122003",

country : "India"

},

"salesToDate" : 12345.6789,

"currencyCode" : "EUR"

});

oModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay);

sap.ui.getCore().setModel(oModel);

// Create a resource bundle for language specific texts

var oResourceModel = new sap.ui.model.resource.ResourceModel({

bundleName : "sap.ui.demo.db.i18n.i18n"

});

// Assign the model object to the SAPUI5 core using the name "i18n"

sap.ui.getCore().setModel(oResourceModel, "i18n");

// Create view

var oView = new sap.ui.core.mvc.XMLView({ viewName : "sap.ui.demo.db.view.App" });

// Register the view with the message manager

sap.ui.getCore().getMessageManager().registerObject(oView, true);

// Insert the view into the DOM

oView.placeAt("content");

});

</script>

</head>

<body class="sapUiBody" id="content">

</body>

</html>

App.view.xml

====================

<mvc:View xmlns="sap.m" xmlns:l="sap.ui.layout" controllerName="sap.ui.demo.db.controller.App" xmlns:mvc="sap.ui.core.mvc">

<Panel headerText="{i18n>panel1HeaderText}" class="sapUiResponsiveMargin" width="auto">

<content>

<Label text="{i18n>firstName}" class="sapUiSmallMargin" />

<Input value="{/firstName}" valueLiveUpdate="true" width="200px" enabled="{/enabled}" />

<Label text="{i18n>lastName}" class="sapUiSmallMargin" />

<Input value="{/lastName}" valueLiveUpdate="true" width="200px" enabled="{/enabled}" />

<CheckBox selected="{/enabled}" text="{i18n>enabled}" />

</content>

</Panel>

<Panel headerText="{i18n>panel2HeaderText}" class="sapUiResponsiveMargin" width="auto">

<content>

<l:VerticalLayout>

<Label class="sapUiSmallMargin" text="{i18n>address}:" />

<Text class="sapUiSmallMargin"

text="{/address/street}\n{/address/zip} {/address/city}\n{/address/country}"

width="200px" />

<Image class="sapUiSmallMargin" width="500px" height="300px" src="{ parts: [ '/address/street', '/address/zip', '/address/city', '/address/country' ], formatter: '.formatMapUrl' }" />

</l:VerticalLayout>

<l:VerticalLayout>

<Label text="{i18n>salesToDate}" class="sapUiSmallMargin" />

<Input

width="200px"

enabled="{/enabled}"

description="{/currencyCode}"

value="{ parts: [{path: '/salesToDate'}, {path: '/currencyCode'}], type: 'sap.ui.model.type.Currency', formatOptions: {showMeasure: false } }"

/>

</l:VerticalLayout>

</content>

</Panel>

</mvc:View>

=========================================

Any suggestion where it might have gone wrong.

BR,

Attachments

nofocus.png (5.2 kB)