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

本文解决在ExtJS5.1中使用tabpanel组件时遇到的错误,通过引入特定代码片段来修复`UncaughtTypeError:c.isFocusableisnotafunction`错误。重点介绍了代码修改的具体步骤及解决思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

转载于:https://www.cnblogs.com/yuxiaoqi/p/5124093.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值