combobox - 组合框在第二次加载窗口时不显示记录

标签 combobox extjs

现在已经为一个问题苦苦挣扎了一两天。我有一个包含 2 个组合框的 Ext.Window。在第一次加载时一切正常,两个商店都已填充并且组合的工作正常。

但是,如果我第二次 .show() 窗口,组合框不会“下拉”以显示列表。我已经检查了 Firebug,虽然正在填充商店,但没有条目被添加到组合框中。

这是窗口的代码:

uTransferWindow = new Ext.Window({
                id              : 'windowUserLicenseTransfer',
                title           : 'Title',
                width           : 405,
                autoScroll      : true,
                closeAction     : 'hide',
                closable        : false,
                modal           : true,
                bodyStyle       : 'background-color:#FFF',
                buttonAlign     : 'center',
                items           : new Ext.form.FormPanel({
                    labelAlign      : 'left',
                    labelWidth      : 140,
                    bodyStyle       : 'padding:10px 10px 0 10px',
                    border          : false,
                    defaults: {
                        xtype: 'ComboBox',
                        anchor: '100%',
                        tpl: '<tpl for="."><div class="x-combo-list-item"><div style="position:absolute;left:4px;">{initials}</div><div style="position:relative;left:50px;">{username}</div></div></tpl>',
                        displayField: 'username',
                        valueField: 'userid',
                        typeAhead: true,
                        mode: 'local',
                        triggerAction: 'all'
                    },
                    items: [{
                        hiddenName: 'fromuserid',
                        fieldLabel: 'From User',
                        id          : 'drop1',
                        store: userswithlicenses
                    }, {
                        hiddenName: 'touserid',
                        fieldLabel: 'To User',
                        id          : 'drop2',
                        store: userswithoutlicenses
                    }]
                }),
                buttons     : [{
                    text        : 'Transfer License',
                    handler     : function() {
                        //do stuff
                    }
                }, {
                    text: 'Cancel',
                    handler: function() { uTransferWindow.hide(); }
                }]
            }),

我在论坛上找不到其他有类似问题的人,我们将不胜感激。

更新:虽然发现了一些小东西:当第二次显示窗口时,z-index 确实增加了。为什么每次显示窗口时 z-index 都会增加?

最佳答案

确保您没有多次调用 new Ext.Window - 因为如果您使用相同的配置调用 new 窗口而不是销毁窗口,那么组合框的 id 将发生冲突并具有您的行为描述。

关于combobox - 组合框在第二次加载窗口时不显示记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2325207/

相关文章:

javascript - 如何使用 jQuery 将选定值设置为多个 Select 输入?

c# - 在 C# 中调整 ComboBox DropDown 宽度

testing - 如何使用 groovy 在 geb 中选择组合框

ExtJS 轮播实现

java - 如何在 Swing 中组合组合框和树?

c# - 如何在 C# 中使用子字符串从组合框中获取值

extjs - 存储同步 : Many deletions, 一些失败

javascript - ExtJS 操作 propertygrid 源信息

javascript - 从 ExtReact 6.6.0 中的 FormPanel 获取值

javascript - 调试 css ipad