组合框内的Extjs网格

问题描述 投票:2回答:2

人。我需要有关extjs的提示。我需要具有能够从网格填充的文本字段。我的意思是用户具有一个带下拉列表的字段,他可以打开并选择一个网格行以绑定到我的文本字段。我将有一个隐藏字段,其中包含要引用的字段的ID,以及基于要在文本字段中显示的所选网格行的一些viewmodel。我的问题是我如何在其中有一个带有网格的组合框(实际上是实时搜索,但现在并不重要)?实际上有可能吗?

javascript extjs extjs4
2个回答

0
投票

这是一个内部带有网格的组合框,您可以使用本地搜索过滤器和排序。但是单击组合框开始时几乎没有问题,它从页面顶部显示。

如果有人找到任何解决方案,请帮帮我。

 var dropGridStore = Ext.create('Ext.data.Store', {
        fields: ['name', 'email', 'phone'],

        data: [
            { name: 'Lisa', email: '[email protected]', phone: '555-111-1224', active: true },
            { name: 'Bart', email: '[email protected]', phone: '555-222-1234', active: false },
            { name: 'Homer', email: '[email protected]', phone: '555-222-1244', active: true },
            { name: 'Marge', email: '[email protected]', phone: '555-222-1254', active: false },
            { name: 'Lisa', email: '[email protected]', phone: '555-111-1224', active: true },
            { name: 'Bart', email: '[email protected]', phone: '555-222-1234', active: false },
        ]
    });

    var GridDrop = Ext.create('Ext.grid.Panel', {
        floating: true,
        //modal: true,
        //fixed: true,
        valueField: 'name',
        store: dropGridStore,
        maxHeight: 500,
        columns: [
            { xtype: 'checkcolumn', text: 'Active', dataIndex: 'active' },
            { text: 'Name', dataIndex: 'name', flex: 1 },
            { text: 'Email', dataIndex: 'email', flex: 1 },
        ],
        bbar: [
            {
                xtype: 'button',
                text: 'SelectAll',
                flex: 1,
                listeners: {
                    click: function (btn, e, eOpts)
                    {
                        debugger;
                    }
                }
            }, ,
            {
                xtype: 'button',
                text: 'ClearAll',
                flex: 1,
                handler: function () {
                    //alert('ClearAll');
                }
            },
        ],
        width: '100%',
    });

    var ComboStore = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data: [
            { "abbr": "AL", "name": "Alabama" },
            { "abbr": "AK", "name": "Alaska" },
            { "abbr": "AZ", "name": "Arizona" }
        ]
    });


    Ext.define('Demo.view.DropdownGrid', {
        extend: 'Ext.form.field.Picker',
        alias: 'widget.ComboGrid',
        width: '100%',
        fieldLabel: 'Choose Hobby',
        displayField: 'name',
        store: ComboStore,
        createPicker: function () {
            return GridDrop;
        },
        listeners:
        {
            expand: function ()
            {
                //debugger;
            }
        }
    });

提前谢谢您

© www.soinside.com 2019 - 2024. All rights reserved.