PDA

View Full Version : How use in same time action column and rowclick listener?



leduc
3 Nov 2011, 2:00 AM
Hello All,

I have a gridPanel with an action column (5 actions) and I had a listener for rowclick.
My problem is when I click one of the action (from actionColumn) , the listener is catch and the action in the listener is call.
--> It's normal, but it's a problem !!! ;)

I try to get the column index on the listener to deactived it when the click is make from my actionColumn, but I can not find columnIndex with rowclick function.

Any idea?

Thanks for your help.

mitchellsimoens
3 Nov 2011, 5:44 AM
The 5th argument passed on the handler for the action column is an EventObject but stopEvent didn't work, that would have been great! So my next way was to do this:


listeners : {
rowclick: function(grid, rowIndex, e) {
var target = e.getTarget(null, null, true);

if (target.hasClass('x-action-col-icon')) {
return;
}

console.log('row click fired');
}
}

The rowclick happened on the image so I checked to see if it had the action column CSS class and if it does, it stops the rowclick function.

leduc
3 Nov 2011, 5:51 AM
Hello mitchellsimoens,

I have just to say great !!

I just test your code, and it's ok !

Thank you.

mitchellsimoens
3 Nov 2011, 5:56 AM
Good! Best way would have been e.stopEvent(); in the handler but that didn't work.

leduc
3 Nov 2011, 6:02 AM
Ok, I will test with e.stop.event() for a futur case in an other context.
Thanks for your help.


PS: I want to try your carroussel, but nothing is display, only a little blue banner at the right top with a big M.
(firefox 7.0, windows 7 64b). With IE8, only a blank page with tab title and an error on structure.js and sencha-touch.js...

mitchellsimoens
3 Nov 2011, 6:06 AM
Sencha Touch only supports webkit browsers like Chrome and Safari.

leduc
3 Nov 2011, 6:08 AM
Ok, sorry, I didn't known.
So, I try it at home ;-).

freedomson
26 Mar 2014, 2:25 AM
beforecellclick : function(me, td, cellIndex, record, tr, rowIndex, e, eOpts) {

if (Ext.get(td).el.hasCls('x-action-col-cell')) {

Ext.log('This is a action cell');

}

}