Skip to Content
0

event in fragment not working

Dec 23, 2016 at 11:31 AM

52

avatar image

Hellos, i am doing a app sapui5 and i have a problem because i have done the fragment in which there is a event and this event is defined in the controller, so i did this:

controllerName="sacyr.controller.pendienteContabilizar" in the fragment but this not is working. If i put the fragment in the view directly, it is working goog. can somebody help me?.

Sorry for my english

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Dec 23, 2016 at 12:36 PM
0
Share
10 |10000 characters needed characters left characters exceeded
david del casar Dec 23, 2016 at 03:02 PM
0

thanks, but it yet not working, in the fragment i have this:

<core:FragmentDefinition xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns:commons="sap.ui.commons" controllerName="jas.controller.pendienteContabilizar"> <HBox > <VBox> </VBox> <VBox > <Label text="postright1"></Label> </VBox> <VBox> <Button icon="sap-icon://decline" press="eliminar" /> </VBox> </HBox> </core:FragmentDefinition>

and in the controller this is;

eliminar: function () { if (!this._oDialog) { this._oDialog = sap.ui.xmlfragment("sacyr.fragmento.selectext", this); this.getView().addDependent(this._oDialog); } return this._oDialog; },

i think the problem is that the fragment adds dinamic content

Show 2 Share
10 |10000 characters needed characters left characters exceeded

you have to assign the controller first. then you can use eliminar as event handler


0

Hi David,

Can you paste how you have called the above fragment.

<core:FragmentDefinition xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" 
xmlns:commons="sap.ui.commons" controllerName="jas.controller.pendienteContabilizar">
 <HBox > <VBox> </VBox> 
   <VBox > <Label text="postright1"></Label> 
  </VBox> 
  <VBox> 
   <Button icon="sap-icon://decline" press="eliminar" /> 
  </VBox> 
</HBox> 
</core:FragmentDefinition>

I think you are missing the 'this' keyword in the original fragment call as well.

0