简体   繁体   English

第一次单击当前编辑行中的ComboBox时,Ext 4 RowEditor编辑将取消

[英]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.

相关问题 Roweditor中的Ext JS复选框 - Ext JS Checkbox in Roweditor 如何使行编辑器在 extJS 行编辑器中始终可见 - How to make row editor visible all the time in extJS roweditor 在网格Ext JS中未禁用行编辑? - Row editing is not being disabled in the grid Ext JS? Ext JS 4行编辑保存问题 - Ext JS 4 row editing save issues ValidateEdit事件不会在Ext rowEditor上触发 - ValidateEdit event doesn't fire on Ext rowEditor 编辑/更新使用Knockout可观察数组绑定的jqxGrid的行值时的问题,替换使用javascript对象编辑的可观察对象 - Issue when Editing/Updating row values of jqxGrid bound with a Knockout observable array, replace observable object edited with a javascript object 当 JavaScript 取消超链接“click”事件时,屏幕阅读器会做什么? - What do screenreaders do when JavaScript cancels a hyperlink `click` event? jqGrid内联编辑:防止用户在正在编辑的行之外单击(防止取消对行的编辑/添加) - jqGrid Inline Editing: Prevent User from Clicking Outside of Row Being Edited (prevent cancelling the editing/adding of row) 除非先单击,否则不会填充Ext.form ComboBox - Ext.form ComboBox doesn't populate unless clicked first 使用Ext.define()扩展网格面板时如何添加行双击事件侦听器? - How to add row double click event listener when extending grid panel with Ext.define()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM