Extjs网格在childlongpress后防止childtap
在childlongpress事件后的网格a上,也会触发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' }, {
有什么简单的方法可以防止这种情况吗?我为您的问题制定了
解决方案
我比较点击
点,如果点击
与长按
相同,我拒绝它
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'
}]
});
小提琴的例子: