Page 1 of 1

Hyperlink and onrowclick on the same subfile row

Posted: Wed Mar 13, 2013 1:44 pm
by robhathome2
Hi

I have a subfile row with a hyperlink AND onrowclick. When the user clicks the hyperlink I'd like it to only process the hyperlink (we make it open a new tab in Atrium). I appreciate I could change from onrowclick to onrowdblclick but I'd prefer not to. Can I use the preventEvent api to disable the onrowclick (not sure if the onrowclick gets processed first)? Or could I perform some test in the onrowclick script to see if the hyperlink has also been clicked and therefore not perform the onrowclick code?

Any thoughts appreciated.

Rob.

Re: Hyperlink and onrowclick on the same subfile row

Posted: Thu Mar 14, 2013 2:30 pm
by Scott Klement
Hi Rob,

It looks like if you have both an "onrowclick" and a hyperlink defined, the hyperlink "onclick" event fires first, and then the "onrowclick" will fire.

With that in mind, I would create a JavaScript file in your /www/INSTANCE-NAME/htdocs/profoundui/userdata/custom/js directory. Maybe call it somethign like YOURAPP_handleclick.js AS long as it is within the "custom" directory and ends in .js, PUI will pick it up automatically when your session is restarted.

In that JavaScript file, I would create a function to call in your hyperlink clicks. Something like this:

Code: Select all

function handleHyperlinkClick(e, target) {

  // do whatever you want to do when the hyperlink is clicked, here.
 
  preventEvent(e);

}
In your onclick event, just assign a value of "handleHyperlinkClick". You need to use an external function like this in order to get the "event" object so you can pass it to preventEvent(). (Otherwise, both the hyperlink and the onrowclick would fire.)

With this in place, when you click the hyperlink, it'll fire this event. When you click anywhere else in the row, your onrowclick event will fire as normal.

Let me know if this helps