gpt4 book ai didi

javascript - 首次单击当前编辑行中的组合框时,Ext 4 RowEditor 编辑取消

转载 作者:行者123 更新时间:2023-11-28 02:44:57 24 4
gpt4 key购买 nike

我有一个Ext.grid.Panel使用 RowEditor 插件,它包含一个带有组合框编辑器的列:

    {
dataIndex: 'parentId',
text: 'Parent category',
editor: {
store: store,
valueField: 'categoryId',
displayField: 'name',
xtype: 'combobox',
allowBlank: true
}

商店看起来像这样:

var store = Ext.create('Ext.data.Store', {
model: 'Category',
autoLoad: true,
proxy: {
type: 'rest',
url: 'api/categories',
reader: {
type: 'json',
root: 'categories'
}
}
});

型号:

Ext.define('Neopod.model.Category', {
extend: 'Ext.data.Model',
fields: ['categoryId', 'name', 'parentId'],
})

当第一次编辑网格行并单击组合框时,ExtJS 会触发从服务器加载数据,并且行编辑器会自动取消。因此用户希望看到组合下拉菜单,但组合未打开,而是编辑模式取消。

那么为什么 ExtJS 会有这样的行为呢?

最佳答案

一个简单的处理方法是使用以下命令配置组合框:queryMode: 'local',这样它就不会在展开时尝试重新加载。

使用您的示例:

{
dataIndex: 'parentId',
text: 'Parent category',
editor: {
store: store,
valueField: 'categoryId',
displayField: 'name',
xtype: 'combobox',
allowBlank: true,
queryMode: 'local'
}
}

您还可以尝试使用 autoCancel: false 配置您的 RowEditing 插件,例如:

Ext.create('Ext.grid.plugin.RowEditing', {
pluginId: 'rowediting',
clicksToEdit: 2,
autoCancel: false
});

关于javascript - 首次单击当前编辑行中的组合框时,Ext 4 RowEditor 编辑取消,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12061254/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com