]> git.proxmox.com Git - extjs.git/blame - extjs/examples/classic/neptune-components/app/controller/Main.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / classic / neptune-components / app / controller / Main.js
CommitLineData
6527f429
DM
1Ext.define('Neptune.controller.Main', {\r
2 extend: 'Ext.app.Controller',\r
3\r
4 stores: [\r
5 'FileSystem',\r
6 'Company'\r
7 ],\r
8\r
9 refs: [\r
10 {\r
11 ref: 'navigation',\r
12 selector: 'navigation'\r
13 },\r
14 {\r
15 ref: 'content',\r
16 selector: 'content'\r
17 }\r
18 ],\r
19\r
20 init: function() {\r
21 this.control({\r
22 'navigation': {\r
23 selectionchange: this.onNavSelectionChange\r
24 },\r
25 'content': {\r
26 afterrender: this.afterContentRender\r
27 }\r
28 });\r
29 },\r
30\r
31 onNavSelectionChange: function(selModel, records) {\r
32 var id = records[0].get('id');\r
33\r
34 if (id && records[0].get('leaf')) {\r
35 this.getContent().getLayout().setActiveItem(id);\r
36 location.hash = id;\r
37 }\r
38 },\r
39\r
40 afterContentRender: function(contentPanel) {\r
41 var id = location.hash.substring(1) || 'panels',\r
42 navigation = this.getNavigation();\r
43\r
44 navigation.getSelectionModel().select(navigation.getStore().getNodeById(id));\r
45 }\r
46});