在ExtJS 7.7 grid classic toolkit中,当使用cellediting插件时,我无法显示combobox选项

4bbkushb  于 9个月前  发布在  其他
关注(0)|答案(2)|浏览(85)

在ExtJS 7.7 grid classic toolkit中,当使用cellediting插件时,我无法显示combobox选项。这发生在ExtJS Kitchensink示例本身。这很可能是一个bug。在ExtJS 7.6中没有任何问题

Ext.define('KitchenSink.view.grid.CellEditing', {
    extend: 'Ext.grid.Panel',
    xtype: 'cell-editing',
    controller: 'cell-editing',

    requires: [
        'Ext.selection.CellModel'
    ],

    title: 'Cell Editing Plants',
    width: 680,
    height: 350,

    autoLoad: true,
    frame: true,
    selModel: {
        type: 'cellmodel'
    },

  

    plugins: {
        cellediting: {
            clicksToEdit: 1
        }
    },

    store: {
        model: 'KitchenSink.model.Plant',

        proxy: {
            type: 'ajax',
            url: 'data/grid/plants.xml',

            reader: {
                type: 'xml',    // XmlReader since returned data is in XML
                record: 'plant' // records are in 'plant' tags
            }
        },

        sorters: [{
            property: 'common',
            direction: 'ASC'
        }]
    },

    columns: [{
        header: 'Common Name',
        dataIndex: 'common',

        flex: 1,
        editor: {
            allowBlank: false,
            selectOnFocus: false
        }
    }, {
        header: 'Light',
        dataIndex: 'light',

        width: 130,
        editor: {
            xtype: 'combo',
            typeAhead: true,
            triggerAction: 'all',
            selectOnFocus: false,
            store: [
                ['Shade', 'Shade'],
                ['Mostly Shady', 'Mostly Shady'],
                ['Sun or Shade', 'Sun or Shade'],
                ['Mostly Sunny', 'Mostly Sunny'],
                ['Sunny', 'Sunny']
            ]
        }
    }, {
        header: 'Price',
        dataIndex: 'price',

        width: 70,
        align: 'right',
        formatter: 'usMoney',
        editor: {
            xtype: 'numberfield',
            selectOnFocus: false,
            allowBlank: false,
            minValue: 0,
            maxValue: 100000
        }
    }, {
        xtype: 'datecolumn',
        header: 'Available',
        dataIndex: 'availDate',

        width: 95,
        format: 'M d, Y',
        editor: {
            xtype: 'datefield',
            selectOnFocus: false,
            format: 'm/d/y',
            minValue: '01/01/06',
            disabledDays: [0, 6],
            disabledDaysText: 'Plants are not available on the weekends'
        }

    }]
});

在编辑模式下单击和时,无法单击触发器以显示组合框和日期字段中的选项
它可能是一个bug。请给予一个变通办法。或者你知道新版本已经修复了这个bug吗?

7xzttuei

7xzttuei1#

使用此覆盖:

Ext.define('CellEditingPluginOverride', {
    override: "Ext.view.Table",
    focusPosition: function() {
        Ext.emptyFn();
    },
});
8iwquhpp

8iwquhpp2#

我可以确认KitchenSink中的示例不起作用。他们还在发行说明中提到,单元格编辑有一些变化,但不确定具体是什么。
在7.7版本中,我使用valueField使它工作。我还必须将组合框的记录转换为对象列表而不是矩阵。

// ...
        header: 'Light',
        dataIndex: 'light',
    
        width: 130,
        editor: {
            xtype: 'combo',
            typeAhead: true,
            triggerAction: 'all',
            selectOnFocus: false,
            valueField: 'value',
            displayField: 'text',
            store: [
                {text: 'Shade', value: 'Shade'},
                {text: 'Mostly Shady', value: 'Mostly Shady'},
                {text: 'Sun or Shade', value: 'Sun or Shade'},
                {text: 'Mostly Sunny', value: 'Mostly Sunny'},
                {text: 'Sunny', value: 'Sunny'}
            ]
        }
    }, {
// ...

相关问题