如何用双击事件替换默认的单击事件,以在ExtJS中选择网格行 [英] How to replace the default click event by a double click event for grid row selection in ExtJS

查看:79
本文介绍了如何用双击事件替换默认的单击事件,以在ExtJS中选择网格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ExtJS 6.2.0中.我有一个标准的网格.默认情况下,网格的选择模型及其所有相关功能(如网格行的突出显示)均由单击事件触发. 我想保留所有选择模型的功能,但要由双击事件来驱动.
我一直在考虑终止默认的单击事件监听器,并引入专用的双击事件监听器.但是我在此默认事件侦听器上找不到任何句柄.
有什么建议吗?

In ExtJS 6.2.0. I have a standard grid. The grid's selection model, and all of it's related functions like the highlighting of grid rows, is by default triggered by the single click event. I would like to keep all of the selection model's functionality, but driven by a double click event instead.
I was thinking along the line of killing the default single click event listener, and introducing a dedicated double click event listener. But I can't find any handle on this default event listener.
Any suggestions?

推荐答案

在网格插件中使用clicksToEdit属性,如下所示

Use clicksToEdit property in grid plugins as follow

Ext.define('Test.MyGrid', {
extend:'Ext.grid.Panel',
store: store,
xtype:'myGrid',
 plugins: {
    rowediting: {
        clicksToEdit: 2,
        autoCancel: false
    }
},
columns: [
    { text: 'Name', dataIndex: 'name',editor:{
                allowBlank: false
        } },
    { text: 'Email', dataIndex: 'email', flex: 1 },
    { text: 'Phone', dataIndex: 'phone' }
]

});

检查工作示例 https://fiddle.sencha.com/#view/编辑& fiddle/2ma9

这篇关于如何用双击事件替换默认的单击事件,以在ExtJS中选择网格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆