未捕获TypeError:无法使用Sencha读取未定义的属性“apply” [英] Uncaught TypeError: Cannot read property 'apply' of undefined with Sencha

查看:168
本文介绍了未捕获TypeError:无法使用Sencha读取未定义的属性“apply”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些sencha触摸的问题。
我有这个简单的代码:

  items:[
{
name:horo
xtype:'togglefield',
label:'Horodateur?',
labelWidth:'55%',
disabled:false,
listeners:{
beforechange:function(slider,thumb,newValue,oldValue){
if(oldValue == 0&& newValue == 1){
alert(toto);
}
},
更改:function(slider,thumb,newValue,oldValue){
if(oldValue == 0&& newValue == 1){
alert(titi);
}
else if(oldValue == 1&& newValue == 0)
alert(tata);
}
}
},

我有这个错误在我的控制台上:


未捕获TypeError:无法读取未定义的属性apply。


有什么问题?
我的控制台说别的什么,也许$ code> Controller.js 是问题。

解决方案

我也有同样的问题。
当您定义一些监听器并且您没有在控制器中定义该函数时,可能会发生此问题。
我可以看到beforechange和change有功能,所以也许你的代码中有更多的项目,你没有在论坛中显示。如果有一个监听器和一个不存在的函数的侦听器引用,那么你会得到一个错误。
未捕获TypeError:无法读取未定义的属性apply


I have some problems with sencha touch. I have this simple code :

items: [
        {
            name: "horo",
            xtype: 'togglefield',
            label: 'Horodateur ?',
            labelWidth: '55%',
            disabled: false,
            listeners: {
                beforechange: function (slider, thumb, newValue, oldValue) {
                    if (oldValue == 0 && newValue == 1) {
                        alert("toto");
                    }
                },
                change: function (slider, thumb, newValue, oldValue) {
                    if (oldValue == 0 && newValue == 1) {
                        alert("titi");
                    }
                    else if (oldValue == 1 && newValue == 0)
                        alert("tata");
                }
            }
        },

And I have this error on my console :

Uncaught TypeError: Cannot read property 'apply' of undefined.

What's the problem ? My console say something else, maybe the Controller.js is the problem.

解决方案

I had the same problem. This problem can occur when you define some listeners and you did not define the function in your controller. I can see that beforechange and change have functions so maybe there are more items in your code that you have not shown here in the forum. If there are listeners and the listener referer to a function that do not exist then you will get an error. "Uncaught TypeError: Cannot read property 'apply' of undefined"

这篇关于未捕获TypeError:无法使用Sencha读取未定义的属性“apply”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆