Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
combobox上的事件侦听器不会激发EXTJS 4_Extjs_Extjs4 - Fatal编程技术网

combobox上的事件侦听器不会激发EXTJS 4

combobox上的事件侦听器不会激发EXTJS 4,extjs,extjs4,Extjs,Extjs4,您好:)我已经使用Ext.form.combobox创建了一个combobox组件。 我添加了一个listner,它是一个变更触发器 listeners: { change: function() { if( this.getValue().length > 1){ alert('Val 1') } else{

您好:)我已经使用Ext.form.combobox创建了一个combobox组件。 我添加了一个listner,它是一个变更触发器

listeners: {
           change: function() {
               if( this.getValue().length > 1){
                        alert('Val 1')
               }
               else{
                   alert('Val 2');
               }
         }
因此,当我插入一个大于1个字符的值时,就会触发“Val 1”

但是当我删除插入的值,并且我的组合框上没有任何内容时,“val 2”不会被触发

我觉得这很奇怪!一个为什么会这样的想法

注意:如果我插入一个仅触发1个字符“Val 2”的值。

已解决

if(this.getValue() == null){
                  alert('Val 2')
               }
               else if( this.getValue().length > 1){
                  alert('Val 1');
               }
我认为在null值的情况下,第二个测试this.getValue().length(这是问题代码中的第一个)返回错误,并且程序不会继续执行

我没有注意到,因为控制台中没有显示任何内容