日期:2014-05-16 浏览次数:20410 次
?
// 注册ctrl+tab组合键到keymap var keyMap=new Ext.KeyMap(Ext.getBody(),[{ key:[9], //tab ctrl:true, fn:function(){handleCtrlTab();} scope:this, defaultEventAction: "stopEvent" }] ); keyMap.enable(); // 实现tabpanel的切换 function handleCtrlTab() { var targetTabPanel = Ext.getCmp('mytabpanel'); var curTab = targetTabPanel.getActiveTab(); var curIndex = targetTabPanel.items.indexOf(curTab); var nextTabIndex = curIndex + 1; var itemSize = targetTabPanel.items.length; if (nextTabIndex >= itemSize) { nextTabIndex = 0; } var nextTab = targetTabPanel.items.itemAt(nextTabIndex); targetTabPanel.activate(nextTab); // 10ms进行聚焦,保证连续响应ctrl+tab nextTab.focus(false, 10); }?