简体   繁体   English

ExtJS 4.1.x - 里面有一个Combobox的Picker

[英]ExtJS 4.1.x - Picker with a Combobox inside

I have a custom picker class with some text fields and a combobox inside. 我有一个自定义选取器类,里面有一些文本字段和一个组合框。 A grid in the app is using this picker as an editor for a column, but the problem is that anytime I click the combobox, the picker loses it's focus and closes. 应用程序中的网格使用此选择器作为列的编辑器,但问题是,无论何时单击组合框,选择器都会丢失它的焦点并关闭。 Is there a way to modify the picker in order to use the combobox for select data? 有没有办法修改选择器以使用组合框来选择数据?

I found a workaround for this issue by using the collapseIf function. 我通过使用collapseIf函数找到了解决此问题的方法。

This code checks if the event target is a BoundList (internally used DataView for ComboBox ) and part of the picker component: 此代码检查事件目标是否为BoundList (内部使用的DataView for ComboBox )和部分选择器组件:

collapseIf: Ext.Function.createInterceptor(Ext.form.field.Picker.prototype.collapseIf, function (e) {
        var boundList = Ext.get(e.target).up('.x-boundlist'),
            cmp;

        cmp = boundList && Ext.getCmp(boundList.id);

        if (cmp && this.picker.down('#' + cmp.pickerField.id)){
            return false;
        }
    })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM