/** * This class is the controller for the main view for the application. It is specified as * the "controller" of the Main view class. */ Ext.define('saas.view.main.MainController', { extend: 'Ext.app.ViewController', alias: 'controller.main', setActiveTab: function(dataset) { var me = this, refs = me.getReferences(), mainTab = refs.mainTabPanel, // existingItem = mainTab.child(type), newView, type = dataset.type, title = dataset.text, tabTitle = title + (type == 'form' ? '' : '查询'), id = dataset.id, tabId = 'maintab-' + type + '-' + id, existingItem = mainTab.down('[id=' + tabId + ']'), lastView = mainTab.getActiveTab(); if (!existingItem) { existingItem = Ext.create('saas.view.core.tab.Panel', { id: tabId, title: tabTitle, tabViewConfig: dataset }); Ext.suspendLayouts(); mainTab.setActiveTab(mainTab.add(existingItem)); Ext.resumeLayouts(true); }else { mainTab.setActiveTab(existingItem); } }, onToggleNavigationSize: function () { var me = this, refs = me.getReferences(), navigationList = refs.navigationTreeList, navCollapsed = !navigationList.navCollapsed, new_width = navCollapsed ? 64 : 160, ope = navCollapsed ? 'addCls' : 'removeCls'; refs.mainLogo.animate({dynamic: true, to: {width: new_width}}); navigationList.body.animate({dynamic: true, to: {width: new_width}}); navigationList.animate({dynamic: true, to: {width: new_width}}); navigationList.el[ope]('nav-collapsed'); navigationList.navCollapsed = navCollapsed; } });