Skip to content

Commit 6927b79

Browse files
committed
Added everything for Step 14: Make Dialogs Bookmarkable
1 parent d863631 commit 6927b79

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

webapp/controller/employee/overview/EmployeeOverviewContent.controller.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,47 @@ sap.ui.define([
3838
_onRouteMatched: function (oEvent) {
3939
// save the current query state
4040
this._oRouterArgs = oEvent.getParameter("arguments");
41-
//make sure we either have a value or empty hand empty object
4241
this._oRouterArgs["?query"] = this._oRouterArgs["?query"] || {};
4342
var oQueryParameter = this._oRouterArgs["?query"];
4443

4544
// search/filter via URL hash
4645
this._applySearchFilter(this._oRouterArgs["?query"].search);
4746
// sorting via URL hash
4847
this._applySorter(oQueryParameter.sortField, oQueryParameter.sortDescending);
48+
// show dialog via URL hash
49+
if (oQueryParameter.showDialog) {
50+
this._oVSD.open();
51+
}
4952
},
5053

5154
onSortButtonPressed: function () {
52-
this._oVSD.open();
55+
// this._oVSD.open();
56+
var oRouter = this.getRouter();
57+
this._oRouterArgs["?query"].showDialog = 1;
58+
oRouter.navTo("employeeOverview", this._oRouterArgs);
5359
},
5460

5561
onSearchEmployeesTable: function (oEvent) {
5662
//this._applySearchFilter(oEvent.getSource().getValue()); -> now being handled when route is matched
5763
var oRouter = this.getRouter();
5864
// update the hash with the current search term -> ?search=<searchValue>
5965
this._oRouterArgs["?query"].search = oEvent.getSource().getValue();
60-
oRouter.navTo("employeeOverview", this._oRouterArgs, true /*no history*/);
66+
oRouter.navTo("employeeOverview", this._oRouterArgs, true /*no history*/ );
6167
},
6268

63-
_initViewSettingsDialog: function () {
69+
_initViewSettingsDialog: function () {
6470
var oRouter = this.getRouter();
6571
this._oVSD = new ViewSettingsDialog("vsd", {
6672
confirm: function (oEvent) {
6773
var oSortItem = oEvent.getParameter("sortItem");
6874
this._applySorter(oSortItem.getKey(), oEvent.getParameter("sortDescending"));
6975
this._oRouterArgs["?query"].sortField = oSortItem.getKey();
7076
this._oRouterArgs["?query"].sortDescending = oEvent.getParameter("sortDescending");
71-
oRouter.navTo("employeeOverview", this._oRouterArgs, true /*without history*/);
77+
oRouter.navTo("employeeOverview", this._oRouterArgs, true /*without history*/ );
78+
}.bind(this),
79+
cancel: function () {
80+
delete this._oRouterArgs["?query"].showDialog;
81+
oRouter.navTo("employeeOverview", this._oRouterArgs, true /*without history*/ );
7282
}.bind(this)
7383
});
7484

0 commit comments

Comments
 (0)