【问题标题】:Ext JS simulate click in next cell of gridExt JS 模拟单击​​网格的下一个单元格
【发布时间】:2018-04-12 07:45:34
【问题描述】:

我有一个包含两列的网格。一个是选择,另一个是小部件。当我在选择中选择某些内容时,我希望单击下一个单元格中的小部件(并打开一个弹出窗口)。我看过但不知道如何在网格中四处走动。

这是选择列。

     {
            text: Visionera.util.MessageHelper.getMessage('ext.accountSettings.editCompanyCustomFields.customFieldType'),
            xtype: 'grid.column.combocolumn',
            dataIndex: 'customFieldTypeId',
            flex: 2,
            editable: true,
            store: Ext.create('Visionera.store.combo.IssueCustomFieldTypesStore'),
            editorSelectListener: function(combo, record, eOpts){                   
                var itemRecord = combo.up('editor').context.record;
                do something...
            }

        },

如果重要的话,这是下一列。

 {
            text: 'value',
            sortable: false,
            hideable: false,
            dataIndex: 'typeAndValueList',
            xtype: 'widgetcolumn',
            flex: 1,
            menuDisabled: true,
            widget: {
                xtype: 'flexiselectwidget',
                editable: true,
                selectorEmptyText: '',
                faIconForValue: 'fa-edit',
                contentXType: 'customfieldcontentpanel',
                listeners: {
                    select: 'onCustomFieldValueSelected',
                    scope: 'controller'
                }
            }
        },

里面有一些自定义的东西,但我希望这对这个问题无关紧要。 editorSelectListener 确实被触发了。 我只是想让它在下一个单元格中创建一个 clikc。

【问题讨论】:

  • 我们也有类似的需求,需要在编辑器中设置minValue的datefield。我们通过以下代码使用cellediting 插件的beforeedit 侦听器实现了这一点:var datefield = Ext.getCmp(context.cell.querySelector('div.x-form-field-date').id); datefield.setMinValue(context.record.get('joiningDate') || new Date());。也许这可以让您了解您的需求。

标签: extjs


【解决方案1】:

使用 combo.up('grid') 获取网格的引用。 然后使用down() 方法选择列。然后使用fireEvent方法以编程方式触发事件并传递所需参数。

【讨论】:

    猜你喜欢
    • 2011-10-05
    • 1970-01-01
    • 2011-01-07
    • 2013-10-11
    • 1970-01-01
    • 2012-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多