Search code examples
javascriptxmlsapui5popover

Enable background when opening a sapui5 popover


How can I avoid the closing of the sap.m.Popover when clicking in the background? I want the background to be enabled even though the popover is still open.


Solution

  • This is what I have done to achieve this functionality. This is not good since we are not using the API methods, but works fine

    One thing you can extend and create your own Popover control with this functionality.

    sap.ui.define([ "sap/m/Popover" ], function(Popover) {
        "use strict";
        return Popover.extend("my.custom.Popover", {
            init : function() {
                Popover.prototype.init.apply(this, arguments);
                this.oPopup.setAutoClose(false);
                this.setFollowOf(false);
            },
            renderer : "sap.m.PopoverRenderer"
        });
    });
    

    Otherwise on the popover instance call these two methods

    popover.oPopup.setAutoClose(false);
    popover.setFollowOf(false);