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
ExtJS-选择第一个组合框后未填充第二个组合框_Extjs_Combobox_Load_Internet Explorer 9_Loading - Fatal编程技术网

ExtJS-选择第一个组合框后未填充第二个组合框

ExtJS-选择第一个组合框后未填充第二个组合框,extjs,combobox,load,internet-explorer-9,loading,Extjs,Combobox,Load,Internet Explorer 9,Loading,我有两个相关的组合框,第二个组合框的值是在选择了第一个组合框中的某个值后填充的 为此,我在第一个组合框的select事件中为第二个组合框使用setValue 下面是两个代码案例,案例1不起作用,但案例2在IE9中起作用: Case1: This doesn't work select:function(combo, record){ Ext.getCmp('voyageMonitoritngVesselCode').store.load();//Loading the

我有两个相关的组合框,第二个组合框的值是在选择了第一个组合框中的某个值后填充的

为此,我在第一个组合框的select事件中为第二个组合框使用setValue

下面是两个代码案例,案例1不起作用,但案例2在IE9中起作用:

Case1: This doesn't work

    select:function(combo, record){
        Ext.getCmp('voyageMonitoritngVesselCode').store.load();//Loading the store of second combobox
        Ext.getCmp('voyageMonitoritngVesselCode').setValue(record[0].data.vslCd);//Setting the value in the second combo-box
    }


Case2: This works

    select:function(combo, record){
        Ext.getCmp('voyageMonitoritngVesselCode').store.load();//Loading the store of second combobox
        alert(record[0].data.vslCd);//The only difference in both cases is this line
        Ext.getCmp('voyageMonitoritngVesselCode').setValue(record[0].data.vslCd);//Setting the value in the second combo-box
    }
也就是说,当我在加载store和设置值之间编写一个警报语句时,这些值将显示在第二个组合框中,但是如果我忽略此警报,则组合框中没有设置值

我觉得商店可能需要时间来加载,而这一次可能是从警报消息“暂停”中得到的。但是作为一个解决方案,我在第二个组合中使用了autoload:true,这样就不必加载存储,但情况仍然是一样的——在没有警报的情况下没有设置值

谁能帮我解释一下吗

浏览器-IE9

ExtJS-4


提前谢谢。

第二个不需要;无法工作,因为加载是一个异步请求,这意味着当您尝试设置值时存储尚未加载,在它提供足够的tme加载它之前设置警报。。。快速解决办法是:

var combo = Ext.getCmp('voyageMonitoritngVesselCode');
combo.store.load({
                callback:function(r, options, success) {
                    combo.setValue(record[0].data.vslCd);
                }
            });

我也在考虑同样的问题,但当我设置autoload:true(并在select上删除store的加载)时,时间也不起作用。这背后的原因是什么?与自动加载的情况一样:true,第二个组合框的存储已经存在。只是为了确认nscrob提供的解决方案有效。希望这对某人有用。但是自动加载的事情仍然模棱两可。