The fragment does not work correctly Controller

I am describing a fragment using this code in the controller formAddElement. (I use thisto transfer the current controller)

this._oDialog = sap.ui.xmlfragment("apps.appIntra.fragment.dialogClienti",this);

In the same controller, I have a function handleSearch

handleSearch: function(oEvent) {
        var sValue = oEvent.getParameter("value");
        var oFilter = new sap.ui.model.Filter("RAG_SOC_1", sap.ui.model.FilterOperator.Contains, sValue);
        var oBinding = oEvent.getSource().getBinding("items");
        oBinding.filter([oFilter]);
  },

when in the fragment I click search function in the controller, not fire.

But if I use

this._oDialog = sap.ui.xmlfragment("apps.appIntra.fragment.dialogClienti", sap.ui.getCore().byId('formAddElement').getController());

all work !! WHAT FOR??? O_o

0
source share
1 answer

"this" should work. you need to run the F12 debugger in chrome to check what "this" is, whether it is an oController object. it may be another object, depending on the calling object.

+1
source

All Articles