要取消回车键作为默认的确认键,可以使用以下代码:

<ext:GridPanel runat="server" ID="GridPanel1">
    <Plugins>
        <ext:CellEditing runat="server">
            <Listeners>
                <SpecialKey Fn="cancelEnterKey" />
            </Listeners>
        </ext:CellEditing>
    </Plugins>
    ...
</ext:GridPanel>

<script>
    function cancelEnterKey(field, e) {
        if (e.getKey() === e.ENTER) {
            e.stopEvent();
        }
    }
</script>

在上面的代码中,我们在 CellEditing 插件上添加了一个 SpecialKey 监听器,该监听器会在按下特殊键时触发一个 JavaScript 函数。在 JavaScript 函数中,我们检查按下的键是否为回车键 (e.ENTER),如果是,则停止事件传播 (e.stopEvent()),从而取消回车键作为默认的确认键。

Ext.NET GridPanel CellEditing 模式下取消回车键确认

原文地址: https://www.cveoy.top/t/topic/qpke 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录