ExtJS 5.1 - tabpanel setActiveTab: Uncaught TypeError: c.isFocusable is not a function

Description

在 ExtJS 5.1 中,使用 tabpanel,用 setActiveTab 来指定激活哪个 tab 的时候抱错:

  Uncaught TypeError: c.isFocusable is not a function

Caused By

这是 ExtJS 5.1 的一个 open issue。

Solution

加上如下代码

 1 Ext.define('Override.ComponentQuery', {
 2     override : 'Ext.ComponentQuery'
 3 }, function() {
 4 
 5     Ext.apply(this.pseudos, {
 6 
 7         focusable : function(cmps) {
 8             var len = cmps.length, results = [], i = 0, c;
 9 
10             for (; i < len; i++) {
11                 c = cmps[i];
12                 // If this is a generally focusable Component (has a focusEl, is
13                 // rendered, enabled and visible)
14                 // then it is currently focusable if focus management is enabled
15                 // or if it is an input field, a button or a menu item
16                 if (c.isFocusable && c.isFocusable()) {
17                     // if (c.isFocusable()) {
18                     results.push(c);
19                 }
20             }
21 
22             return results;
23         },
24 
25     });
26 });

Reference

 

posted on 2016-01-12 13:38  梅山民  阅读(758)  评论(0编辑  收藏  举报

导航