ExtJS4下拉列表框宽度自适应

版权声明:本文为博主原创文章,未经博主允许欢迎转载。 https://blog.csdn.net/wuzuyu365/article/details/84329147
  /**
         * 获取下拉列表框定义
         */
        getBoxTextEditor: function (box_text_store) {
            //定义了下拉列表框
            var editor = new Ext.form.ComboBox({
                editable: false,
                displayField: "text",
                valueField: "id",
                editable: true,
                typeAhead: true,

                mode: "local",
                store: new Ext.data.ArrayStore({
                    fields: ["id", "text"],
                    data: box_text_store
                }),
                listeners: {
                    'focus': {
                        fn: function (e) {
                            //把下拉框展开后的列表部分设为宽度自适应
                            //自动展开,
                            e.expand();
                            this.doQuery(this.allQuery, true);

                            //把下拉框展开后的列表部分设为宽度自适应
                            var t_list_id = e.picker.el.el.id;
                            $('#' + t_list_id).css('width', 'auto');
                            $('#' + t_list_id).css('minWidth', '120px');
                        },
                        buffer: 100
                    }
                }
            });
            return editor;
        }

               >>>          

猜你喜欢

转载自blog.csdn.net/wuzuyu365/article/details/84329147