Skip to content

Commit

Permalink
Added everything for Step 10: Implement “Lazy Loading”
Browse files Browse the repository at this point in the history
  • Loading branch information
wridgeu committed Apr 3, 2020
1 parent 6419bb0 commit 8d6ecce
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
6 changes: 6 additions & 0 deletions webapp/controller/employee/Resume.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ sap.ui.define([
oQuery = oArgs["?query"];
if (oQuery && _aValidTabKeys.indexOf(oQuery.tab) > -1) {
oView.getModel("view").setProperty("/selectedTabKey", oQuery.tab);
// support lazy loading for the hobbies and notes tab
if (oQuery.tab === "Hobbies" || oQuery.tab === "Notes"){
// the target is either "resumeTabHobbies" or "resumeTabNotes"
this.getRouter().getTargets().display("resumeTab" + oQuery.tab);
}

} else {
// the default query param should be visible at all time
this.getRouter().navTo("employeeResume", {
Expand Down
16 changes: 16 additions & 0 deletions webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@
"viewName": "employee.Resume",
"viewLevel": 4,
"transition": "flip"
},
"resumeTabHobbies": {
"viewId": "resumeHobbies",
"parent": "employeeResume",
"viewPath": "com.mrb.UI5-Navigation-and-Routing.view.employee",
"viewName": "ResumeHobbies",
"controlId": "hobbiesTab",
"controlAggregation": "content"
},
"resumeTabNotes": {
"viewId": "resumeNotes",
"parent": "employeeResume",
"viewPath": "com.mrb.UI5-Navigation-and-Routing.view.employee",
"viewName": "ResumeNotes",
"controlId": "notesTab",
"controlAggregation": "content"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions webapp/view/employee/Resume.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<mvc:XMLView viewName="com.mrb.UI5-Navigation-and-Routing.view.employee.ResumeProjects"></mvc:XMLView>
</IconTabFilter>
<IconTabFilter id="hobbiesTab" text="{i18n>tabHobbies}" key="Hobbies">
<Text text="{Hobbies}"/>
<!-- place content via lazy loading OLD: <Text text="{Hobbies}"/>-->
</IconTabFilter>
<IconTabFilter id="notesTab" text="{i18n>tabNotes}" key="Notes">
<Text text="{Notes}"/>
<!-- place content via lazy OLD: <Text text="{Notes}"/>-->
</IconTabFilter>
</items>
</IconTabBar>
Expand Down
3 changes: 3 additions & 0 deletions webapp/view/employee/ResumeHobbies.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc">
<Text text="{Hobbies}"/>
</mvc:View>
3 changes: 3 additions & 0 deletions webapp/view/employee/ResumeNotes.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc">
<Text text="{Notes}"/>
</mvc:View>

0 comments on commit 8d6ecce

Please sign in to comment.