【问题标题】:EXTJS 4.2 implementing multiple Editor xtypes for RowEditing a grid?EXTJS 4.2 为 RowEditing 网格实现多个编辑器 xtypes?
【发布时间】:2013-11-13 15:07:10
【问题描述】:

我正在使用 Extjs 4.2,目前正在使用网格面板上的 RowEditing 插件,以便用户可以在网格中编辑记录。给定列的编辑器 xtype 需要为除一条记录之外的所有记录的“文本字段”。它必须是另一个记录的组合框编辑器。我该如何实施?

听起来几乎需要一个自定义编辑器,但我还没有看到很多这样的例子,当然也没有根据记录信息为列切换编辑器类型的例子。使用 property.Grid ALMOST 似乎是我需要的解决方案,除了我正在查看多条记录的相同键,我认为这不是 property.Grid 的意思。

感谢您提供解决方案或任何有用的帮助。谢谢。

【问题讨论】:

    标签: javascript extjs extjs4.2


    【解决方案1】:

    您需要 2 个编辑器,一个用于文本字段,一个用于组合,以及将根据记录值确定并返回正确编辑器的实用函数。然后,实用程序函数将绑定到您列的 http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.column.Column-method-getEditor 方法。

    更多信息在这里:https://stackoverflow.com/a/7026075/1038593 另请查看:http://www.sencha.com/forum/showthread.php?139440-changing-columnEditor-per-row-basis&p=637831&viewfull=1#post637831

    【讨论】:

    • 我知道我需要使用 'bind' 方法将函数绑定到列,但据我所知,行编辑和文本编辑只能通过 ExtJs 4.2 中的插件使用。
    【解决方案2】:

    这是否是正确的做法:

    plugins: [
                Ext.create('Ext.grid.plugin.RowEditing', {
                    clicksToEdit: 1,
                    listeners: {
                        beforeedit : function(editor, context, eOpts){
                            if (context.record.getData().aliasName == 'document' && context.column.dataIndex == 'value')
                                //setEditor to combobox with column.setEditor()
                            else
                               //setEditor to textfield with column.setEditor()
                        }
                    }
                })
    ],
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      相关资源
      最近更新 更多