forked from js1972/test_ui5_routing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponent.js
More file actions
80 lines (69 loc) · 1.82 KB
/
Component.js
File metadata and controls
80 lines (69 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
Component details:
- Main Control: sap.m.TileContainer (wrapped in sap.m.Shell to center app on screen
and limit width - remove if you want a fullscreen app)
- Views: XML
- Navigation: Component Routing
This Component hands navigation responsibilty to the Router with lazy-loading
of views.
*/
(function() {
"use strict";
jQuery.sap.declare("sap.ui.demo.Component");
sap.ui.core.UIComponent.extend("sap.ui.demo.Component", {
metadata: {
routing: {
config: {
viewType: "XML",
viewPath: "sap.ui.demo.view",
targetControl: "idApp",
clearTarget: false,
transition: "slide"
},
routes: [
{
pattern: "detail/{data}",
name: "detail",
view: "Detail",
targetAggregation: "pages"
},
{
pattern: "",
name: "home",
view: "Home",
viewType: "JS",
targetAggregation: "pages"
}
]
}
},
init: function() {
jQuery.sap.require("sap.m.routing.RouteMatchedHandler");
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
var router = this.getRouter();
this.routeHandler = new sap.m.routing.RouteMatchedHandler(router);
router.initialize();
},
createContent: function() {
// create root view
var oView = sap.ui.view({
id: "idViewRoot",
viewName: "sap.ui.demo.view.Root",
type: "XML",
viewData: {
component: this
}
});
oView.setModel(new sap.ui.model.json.JSONModel("model/mock.json"));
// set device model
var deviceModel = new sap.ui.model.json.JSONModel({
isPhone: jQuery.device.is.phone,
listMode: (jQuery.device.is.phone) ? "None" : "SingleSelectMaster",
listItemType: (jQuery.device.is.phone) ? "Active" : "Inactive"
});
deviceModel.setDefaultBindingMode("OneWay");
oView.setModel(deviceModel, "device");
return oView;
}
});
}());