Hyperlink and onrowclick on the same subfile row

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
robhathome2
Profound User
Posts: 42
Joined: Mon Jun 27, 2011 9:11 am
First Name: Rob
Last Name: Horton
Company Name: Design Group Plc
Contact:

Hyperlink and onrowclick on the same subfile row

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Hyperlink and onrowclick on the same subfile row

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests