I am using rowcontextmenu event of grid to display some options on right click which is working fine on desktop. In iPad i want to implement same functionality on long press but i dint found any such event in sencha docs. I have tried jquery long press plugin but couldn't achieve it. I am using Ext JS 3.4 version. Any hints please.
these listeners (at least) have to be applied to the Ext.grid.RowSelectionModel, so that these events are being properly bound within that particular scope. see this blog article; there are a bunch more DOM event types to consider. the event you are looking for is either called taphold
or longpress
(see the Safari documentation for "Handling Events").
the events of the RowSelectionModel
can be defined alike:
new Ext.grid.GridPanel({
/**
* one has to instance the default row-selection model explicitly,
* in order to be able to configure it's event listeners ...
**/
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
taphold: 'rowcontextmenu'
}
})
});
one can also use Ext.util.Observable to debug events; this comes handy, especially when using a dated framework, where it is rather questionable, in how far the functionality was already supported.
// to intercept all events:
Ext.util.Observable.prototype.fireEvent =
Ext.util.Observable.prototype.fireEvent.createInterceptor(function() {
console.log(this.name);
console.log(arguments);
return true;
});
// to capture the events of a particular component:
Ext.util.Observable.capture(
Ext.getCmp('my-grid-component'), function(event) {
console.info(event);
}
);
with Ext.EventManager.addListener() or .on(), one can define just any missing framework events.