Removing the view and onclick opens it again as if it were new - SAPUI5

I have multiple view setup, main view and then modules that open when a button is clicked after certain actions.

Currently the view is reset for me whenever it is opened, but what I want to accomplish is when the view is left, that it has disappeared from the core and it is initiated again, as if it was opened the first time.

I'm not sure how, and I tried a few things, no one worked as I thought ( .destroy()

, .removeAllContent()

, ...).

Am I missing a function or is there a way to do this?

Some code:

index.js (how the View is instantiated for the first time, it is not called a second time)

module.exports.Partner = function(place) {
    View = require('./app/js/suche.view');
    Bearbeiten = require('./app/js/bearbeiten.view');
    var ctrl = View.getController();
    ctrl.setPlace(ctrl, place);
    ctrl.setEditPlace(ctrl, place);
    ctrl.setCreatePlace(ctrl, place);
    sap.ui.getCore().byId('suche').placeAt(place);
    sap.ui.getCore().byId('suche').byId('searchBtn').attachPress(ctrl.nummerSearch, ctrl);
};

      

(how the view and index.js are called)

handlePartnerSuche : function(){
        this.hideView(); //this is the main view
        var p = require('bit-js-business-partner');
        var partner_view = p.Partner('content');
        p.setCallbackForSchliessen(this, this.callbackForSchliessen);
  },

      

controller (callback function)

callbackForSchliessen: function(){
        this.showView();
    },

      

Second view (as its closed)

handleSchliessen : function () {
        var p = this.getView('suche');
        p.setVisible(false);

        this.callbackMethodSchliessen.call(this.callbackCtrlSchliessen);
    },

      

+3


source to share


1 answer


You mentioned that you cannot use the Router mechanism due to company restrictions - I'm really curious to know what that restriction is :-) - and toggle properties of the visibility

respective views instead .

In this case, I would call the OData service in the method where you set the visibility and (re) bind the ODataModel to that view.



From a performance point of view, I would not recommend destroying views from the kernel

+1


source







All Articles