Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs网格在childlongpress后防止childtap_Extjs - Fatal编程技术网

Extjs网格在childlongpress后防止childtap

Extjs网格在childlongpress后防止childtap,extjs,Extjs,在childlongpress事件后的网格a上,也会触发childtap事件 有什么简单的方法可以防止这种情况吗?我为您的问题制定了解决方案 我比较点击点,如果点击与长按相同,我拒绝它 var userStore = Ext.create('Ext.data.Store', { data: [{ name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' }, {

childlongpress事件后的网格a上,也会触发childtap事件


有什么简单的方法可以防止这种情况吗?

我为您的问题制定了
解决方案

我比较
点击
点,如果
点击
长按
相同,我拒绝它

var userStore = Ext.create('Ext.data.Store', {
    data: [{
        name: 'Lisa',
        email: 'lisa@simpsons.com',
        phone: '555-111-1224'
    }, {
        name: 'Bart',
        email: 'bart@simpsons.com',
        phone: '555-222-1234'
    }, {
        name: 'Homer',
        email: 'homer@simpsons.com',
        phone: '555-222-1244'
    }, {
        name: 'Marge',
        email: 'marge@simpsons.com',
        phone: '555-222-1254'
    }]
});
var last_point = null;
Ext.create('Ext.grid.Grid', {
    renderTo: Ext.getBody(),
    store: userStore,
    width: 400,
    height: 200,
    title: 'Application Users',
    listeners: {
        childtap: function (a, b, c, d) {
            if (Ext.encode(b.event.touch.point) != last_point) {
                console.log("child tap");
            }
            last_point = null;
        },
        childlongpress: function (a, b, c, d) {
            last_point = Ext.encode(b.event.touch.point);
            console.log("childlongpress Event")
        }
    },
    columns: [{
        text: 'Name',
        width: 100,
        sortable: false,
        hideable: false,
        dataIndex: 'name'
    }, {
        text: 'Email Address',
        width: 150,
        dataIndex: 'email',
        hidden: true
    }, {
        text: 'Phone Number',
        flex: 1,
        dataIndex: 'phone'
    }]
});
小提琴的例子: