Skip to Content
avatar image
Former Member

event in fragment not working

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 23, 2016 at 12:36 PM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2016 at 03:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.