/
Routing.js
50 lines (41 loc) · 1.31 KB
/
Routing.js
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
/*
* File: app/controller/Routing.js
*
* This file was generated by Sencha Architect version 2.1.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Sencha Touch 2.1.x library, under independent license.
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more
* details see http://www.sencha.com/license or contact license@sencha.com.
*
* This file will be auto-generated each and everytime you save your project.
*
* Do NOT hand edit this file.
*/
Ext.define('Payback.controller.Routing', {
extend: 'Ext.app.Controller',
config: {
routes: {
'/:tabId': 'gotoTab'
},
refs: {
MainView: '>tabpanel'
},
control: {
"tabpanel": {
activeitemchange: 'onTabpanelActiveItemChange'
}
}
},
onTabpanelActiveItemChange: function(container, value, oldValue, options) {
this.getApplication().getHistory().add(new Ext.app.Action({
url: '/' + value.getItemId()
}), true);
},
gotoTab: function(tabId) {
Ext.Viewport.setActiveItem(0);
var tabPanel = this.getMainView(), //uses our Controller Reference
tabCmp = tabPanel.child('#' + tabId);
tabPanel.setActiveItem(tabCmp || 0);
}
});