Author Topic: prevent rowClick event from firing based on event target  (Read 2581 times)

argo

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 33
    • View Profile
prevent rowClick event from firing based on event target
« on: March 03, 2016, 09:36:51 am »
I have a link (anchor) in a cell that is put there using the column's render() function. In general I'm using the grid rowClick event to bring up additional details about the row selected. However, in this case if the user clicks the anchor tag in that one special column I want to cancel the rowClick at the grid level so I can do something different. I've attempted to use the rowClick's event object to look at the target, but even when the anchor tag is clicked the event target is still the entire row...I assume the event target would be the anchor but it isn't. I've also tried placing my own jQuery event listener on those anchor tags using the .on() method and using the event cancelPropogation() hoping this would prevent the anchor tag click from registering on the row. The event handler registeres, but the cancelPropogation doesn't stop the grid rowClick event from firing.

Any ideas how I might go about doing this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: prevent rowClick event from firing based on event target
« Reply #1 on: March 03, 2016, 10:18:50 am »
Use event.originalEvent.target to detect click on the innermost element.

http://jsfiddle.net/adn8yfkg/2/