首页 > 解决方案 > extjs 树形面板单元格编辑

问题描述

我正在使用 ext 版本 6.5.3。经典的海王星。我有一个带有 cellediting 插件的树形面板,并提供 clicksToEdit 为 1。现在,如果我在树形面板上应用过滤器并单击要编辑的单元格,则需要单击 1 次。但是,如果我单击下一个单元格,则需要单击 2 次才能变为可编辑。请找到以下示例

 Ext.create({
        "xtype": "container",
        renderTo: Ext.getBody(),
        "items": [{
            "xtype": "treepanel",
            "id": "tp",
            store: Ext.create('Ext.data.TreeStore', {
                fields: ['Brand', 'Price'],
                root: {
                    children: [{
                        Brand: 'Brand1',
                        Price: '8M'
                    }, {
                        Brand: 'Brand2',
                        Price: '8M'
                    }, {
                        Brand: 'Brand3',
                        Price: '10M'
                    }]
                }
            }),
            "rootVisible": false,
            "columns": [{
                "xtype": "treecolumn",
                "dataIndex": 'Brand',
                "editor": true,
                "text": "Brands"
            }, {
                "xtype": "treecolumn",
                "dataIndex": "Price",
                "text": "Value",
                "editor": true,
            }],
            "plugins": [{
                "ptype": "cellediting",
                "clicksToEdit": 1
            }]
        }, {
            xtype: 'button',
            text: 'Add Filter',
            handler: function () {
                Ext.getCmp('tp').getStore().addFilter({
                    property: 'Price',
                    value: '8M'
                })
            }
        }, {
            xtype: 'button',
            text: 'Clear Filter',
            handler: function () {
                Ext.getCmp('tp').getStore().clearFilter();
            }
        }]
    });

小提琴链接

  1. 点击“添加过滤器”按钮。
  2. 单击一个单元格并编辑该单元格(不要按 Enter)。
  3. 单击要编辑的下一个单元格(此处需要单击 2 次才能使单元格变为可编辑)。
  4. 单击“清除过滤器”按钮以删除过滤器并执行相同的步骤。(此处第二个单元格将在单击后变为可编辑)

第 3 步的预期结果,单元格应在第一次单击时变为可编辑。这适用于版本“6.0.1”并正在打破“6.5.3”。

有没有可用的解决方法?

标签: extjspluginstreepanel

解决方案


推荐阅读