on 06-30-2017 9:43 AM
H! All,
Please help me on this.
Thanks in advance.
-- Hemal Suthar
Scenario 1:
sample.view.xml
<mvc:View xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="Sample.controller.EmpStat" xmlns:html="http://www.w3.org/1999/xhtml">
<Page id="EmpStat" showHeader="false">
<content>
<HeaderContainer id="gridDOJ" scrollStep="200" scrollTime="200" orientation="Horizontal" height="65px"></HeaderContainer>
</content>
</Page>
</mvc:View>
sample.controller.js
onAfterRendering: function() {
alert("Test");
}
Note: Here afterRendering()
event is called two times.
Scenario 2:
sample.view.xml
<mvc:View xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="Sample.controller.EmpStat" xmlns:html="http://www.w3.org/1999/xhtml">
<Page id="EmpStat" showHeader="false">
<content>
<l:Grid id="gridDOJ" defaultSpan="L3 M4 S6">
<l:content></l:content>
</l:Grid>
</content>
</Page>
</mvc:View>
sample.controller.js
onAfterRendering: function() {
alert("Test");
}
Note: Here afterRendering() Event is called one time only.
why in Scenario 1 event is called twice?
Hi Hemal,
After addition of HeaderContainer to sap.m Lib from 1.44
HeaderContainer has a borrowed class onAfterRendering. from sap.ui.core.control, hence in scenario one headerContainer calls this method once and sap.m.Page calls the method another time. if you use an oEvent in the method like this
onAfterRendering:function(oEvent){
alert("Test"); }
you can use a validation to findout which is the parent control that is calling this event and distinguish for your case.
regards
GB
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.