Table selection issue

I am trying to use table selection and have copied code directly into my dashboard from the example here: Table - PowerShell Universal (ironmansoftware.com)

The table displays properly but selection doesn’t work as expected. Selecting an item, or clicking the button, results in a toast notification that is blank:

image

It actually does work as expected in my test environment but not in production. Both are on 1.5.3, the only differences being that prod has gone through a few more updates of PSU, and the service is running under a domain account.

Any idea what may be wrong?

Product: PowerShell Universal
Version: 1.5.3

Can you post the table code?
Are you using server side or regular

I create a new dashboard, turning Authentication off and keeping the other defaults. Then I put this code in the dashboard script:

New-UDDashboard -Title "Hello, World!" -Content {
$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
    New-UDTableColumn -Property Name -Title "Service Name" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
    New-UDTableColumn -Property Status -Title Status -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select 
    New-UDTableColumn -Property StartupType -Title StartupType -IncludeInExport -ShowFilter -FilterType select
    New-UDTableColumn -Property StartType -Title StartType -IncludeInExport -ShowFilter -FilterType select 
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
    $Item = $EventData
    Show-UDToast -Message "$($Item | out-string)"
}
New-UDButton -Text "GET Rows" -OnClick {
    $value = Get-UDElement -Id "service_table"
    Show-UDToast -Message "$( $value.selectedRows | Out-String )"
}
}

Open the browser console see if there are errors

Going to F12 --> Console, I see only Information messages.

It seems I can reproduce this issue. To do so, I start with a brand new Server 2019 machine (there are some company prereqs on it like Defender A/V, SCCM agent, latest Windows and .net updates, etc.). I install PSU v1.5.3 via the MSI. I create a new dashboard called “TestDash1”, with a URL of “/testdash1”, all other defaults. Then I insert the code above and save.

Thanks for the steps, i will try to reproduce it

One other thing, what browser?

Chrome.

Any luck reproducing this?

yea, remove the out-string and it’s working
i created a server 2019 vm in azure and tested it, as you said it’s blank toast, but when i remove the out-string the toast is working fine.

and i don’t have any idea why is this.

Removing out-string works for me too, and is a perfectly acceptable workaround. Thanks for your help!

1 Like