
I want to display a fragment on top of a View. Which will allow user to enter his credentials. For this, I created a home page, where I'm displaying the data and I created a login page (as a fragment). I'm following this approach because, I have implemented side menu on root view level and if I create a login page as normal page, then root view side menu will be displayed on login page as well and I dont want this.
So, I've created home view where I'm displaying business data and opening login page as a popup on home page. I'm having 2 challenges here.
The first challenge was to display the popup without any interaction of the user. I called "attachDisplay" method in "onInit" life cycle method and this is opening and closing the fragment immediately. To over come this, I simulated button "press" event (created button at runtime), in "onAfterRendering" life cyle method. Now, I can see the popup, problem solved and here comes the second challenge.
After entering uid/pwd, when i click on login, the event handler method of the fragment is not triggering.
Code to simulate button event trigger
onAfterRendering:function(){
this.oButton = new Button({
id: this.getView().createId("logonButton"),
press:this._ShowLogonPopup
});
this.oButton.firePress(); //("press");
}
code to open fragment.
_ShowLogonPopup:function(oEvent){
if(!this.getDialog){
this.getDialog = sap.ui.xmlfragment("logonPage", "mabothulaMaruthi.view.login", this);
}
this.getDialog.open();
}