Uncaught TypeError: Cannot read property 'apply' of undefined with Sencha

匿名 (未验证) 提交于 2019-12-03 08:56:10

问题:

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.

回答1:

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"



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!