[英]Ext 4 RowEditor editing cancels when first time click on ComboBox in currently edited row
I have an Ext.grid.Panel
with RowEditor plugin, and it contains a column with a combobox editor: 我有一个带有RowEditor插件的
Ext.grid.Panel
,它包含一个带有组合框编辑器的列:
{
dataIndex: 'parentId',
text: 'Parent category',
editor: {
store: store,
valueField: 'categoryId',
displayField: 'name',
xtype: 'combobox',
allowBlank: true
}
The store looks like this: 商店看起来像这样:
var store = Ext.create('Ext.data.Store', {
model: 'Category',
autoLoad: true,
proxy: {
type: 'rest',
url: 'api/categories',
reader: {
type: 'json',
root: 'categories'
}
}
});
And model: 和型号:
Ext.define('Neopod.model.Category', {
extend: 'Ext.data.Model',
fields: ['categoryId', 'name', 'parentId'],
})
When editing a grid row and clicking on combobox for the first time, then ExtJS triggers data load from the server and the roweditor cancels automatically. 当编辑网格行并首次单击组合框时,ExtJS会触发从服务器加载数据,并且roweditor会自动取消。 So user expected to see combo dropdown, but combo not opened and instead the edit mode cancels.
因此,用户希望看到组合下拉菜单,但是组合没有打开,而是取消了编辑模式。
So why does ExtJS behave this way ? 那么,为什么ExtJS会这样呢?
A simple handling is to configure your combobox with: queryMode: 'local'
so that it doesn't try to reload whenever it is expanded. 一种简单的处理方法是使用以下命令配置您的组合框:
queryMode: 'local'
以便它在扩展时不会尝试重新加载。
Using your example: 使用您的示例:
{
dataIndex: 'parentId',
text: 'Parent category',
editor: {
store: store,
valueField: 'categoryId',
displayField: 'name',
xtype: 'combobox',
allowBlank: true,
queryMode: 'local'
}
}
You can also try configuring your RowEditing
plugin with autoCancel: false
eg: 您也可以尝试使用
autoCancel: false
配置您的RowEditing
插件autoCancel: false
例如:
Ext.create('Ext.grid.plugin.RowEditing', {
pluginId: 'rowediting',
clicksToEdit: 2,
autoCancel: false
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.