‎2025 Jul 08 10:04 AM - edited ‎2025 Jul 08 10:33 AM
Hello everybody,
I try to extend a standard App "Create maintenance request" (F1511A). I have added a Fragment with button and the button is available:
My Fragment look like this:
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
<Button id='LorCapBtn' text="LorCap" press='extension.customer.create.notif.variant.onLorCapPress'/>
</core:FragmentDefinition>The controller:
sap.ui.define(
[
'sap/ui/core/mvc/ControllerExtension'
,'sap/m/MessageBox'
// ,'sap/ui/core/mvc/OverrideExecution'
],
function (
ControllerExtension
,MessageBox
// ,OverrideExecution
) {
'use strict';
return ControllerExtension.extend("customer.create.notif.variant.MainCntrlExt", {
onLorCapPress : function(oEvent){
console.log("onLorCapPress called");
MessageBox.success("Hello");
},
});
}
);When I press the button nothing happened (no massege box, no message in console).
Do you know what is the problem? What have to be done to run my code?
Regards,
Boguslaw
Request clarification before answering.
Probably you are missing the . before the extension, MainCntrlExt is also missed
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
<Button id='LorCapBtn' text="LorCap" press='.extension.customer.create.notif.variant.MainCntrlExt.onLorCapPress'/>
</core:FragmentDefinition>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Junwu, thx for your hint - the dot was missing, the second part the was missing as well, was the cntroller name. The correct path to my handler is:
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
<Button id='LorCapBtn' text="LorCap" press='.extension.customer.create.notif.variant.MainCntrlExt.onLorCapPress'/>
</core:FragmentDefinition>
I think your namespace in the button is wrong, you're missing MainCntrlExt
Try:
.extension.customer.create.notif.variant.MainCntrlExt.onLorCapPress
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
<Button id='LorCapBtn' text="LorCap" press='.onLorCapPress'/>
</core:FragmentDefinition>have you tried this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.