on 05-23-2018 5:00 PM
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();
}
set a variable on the controller to identify if the view 'onAfterRendering' is called first time or not.
Check the below plunker sample code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.