on 04-22-2016 10:31 AM
Controller:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("test.controller.View1", {
});
onPress: function(){
alert("hi");
}
});
=============================
View:
<mvc:View controllerName="test.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>
<Button
id="id"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds="[]"
text="Raghu"
type="Default"
width=""
enabled="true"
icon=""
iconFirst="true"
activeIcon=""
iconDensityAware="true"
textDirection="Inherit"
validationSuccess=""
validationError=""
parseError=""
formatError=""
validateFieldGroup=""
tap=""
press= "onPress">
<tooltip></tooltip><!-- sap.ui.core.TooltipBase -->
<customData></customData><!-- sap.ui.core.CustomData -->
<layoutData></layoutData><!-- sap.ui.core.LayoutData -->
<dependents></dependents><!-- sap.ui.core.Control -->
</Button>
</content>
</Page>
</pages>
</App>
</mvc:View>
I am creating Button with event press Event name is onPress
onPress: function(){
alert("Hi!! U Pressed Me!!");
}
My question, where should I write the onPress event code in the controller, where exactly I should insert it.
Regards,
Raghu
You need to write it as shown below
Controller:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("test.controller.View1", {
onPress: function(){
console.log("Hi");
}
});
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.