Open New-UDButton href in new tab

Open New-UDButton href in new tab

avatar
Product: PowerShell Universal
Version: 5.016


Is this possible without using an Invoke-UDRedirect?

I have a table with custom columns like below. For some reason using Onclick with Invoke-UDRedirect seems to use the wrong eventdata on occasion (from another object). Button href works fine, except of course it opens in the same window.

Href is faster and works on mobile so it is preferred anyway for a simple URL button.

Working using href

New-UDTableColumn -Property 'Ticket' -Render { 
	New-UDButton -Id "btn$($EventData.Ticket)" -Href "https://url/ticket?id=$($EventData.Ticket)&entry=$($EventData.Entry)" -Text ($EventData.Ticket)
}


Not working consistently with onclick + redirect

New-UDTableColumn -Property 'Ticket' -Render { 
	New-UDButton -Id "btn$($EventData.Ticket)" -OnClick { Invoke-UDRedirect "https://url/ticket?id=$($EventData.Ticket)&entry=$($EventData.Entry)" -OpenInNewWindow } -Text ($EventData.Ticket)
}


avatar

Recommended Answer

We don’t have it but we could add a -Target parameter so you could specify _blank like a regular link to open a new window. If that’s something you want, feel free to open a feature request.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

All Comments (1)

avatar

We don’t have it but we could add a -Target parameter so you could specify _blank like a regular link to open a new window. If that’s something you want, feel free to open a feature request.

Adam Driscoll
PowerShell Expert and Developer at Devolutions