Table selection

This category is reserved for questions related to PowerShell Universal 2.9. If you want post a question for PowerShell Universal Dashboard within PowerShell Universal, please use the PowerShell Universal \ Universal Dashboard category. I’m using the Selection example to base something off. The documentation is available here: https://docs.ironmansoftware.com/dashboard/components/data-display/table#selection

However although the table has checkboxes, touble-clicking on the table and / or clicking the button does not result in any activity. I assume I’m missing something.

Would someone mind taking a look for me please? Code is below.

        $Columns = @(
            New-UDTableColumn -Property ServerName -Title "Server Name" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
            New-UDTableColumn -Property BadRules -Title "Bad Rules" -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select 
            New-UDTableColumn -Property RuleCount -Title "Rule Count" -IncludeInExport -ShowFilter -FilterType select
        )
        # New-UDTable -Id 'firewall_table' -Title "Firewall Rules" -Data $ReportOutput -Columns $Columns -ShowSelection -Dense -ShowSearch  -OnRowSelection {
            New-UDTable -Id 'firewall_table' -Data $ReportOutput -Columns $Columns -Title 'Rules' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
            $Item = $EventData
            Show-UDToast -Message "$($Item | out-string)"
        }
        New-UDButton -Text "GET Rows" -OnClick {
            $value = Get-UDElement -Id "firewall_table"
            Show-UDToast -Message "$( $value.selectedRows | Out-String )"
        }
New-UDDashboard -Title "Hello, World!" -Content {
        $ReportOutput = Get-NetFirewallRule | Select DisplayName,@{n = "Direction";e={ $_.Direction.ToString()}},@{n = "Enabled";e={ $_.Enabled.ToString()}}
        $Columns = @(
            New-UDTableColumn -Property DisplayName -Title "DisplayName" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
            New-UDTableColumn -Property Direction -Title "Direction" -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select 
            New-UDTableColumn -Property Enabled -Title "Enabled" -IncludeInExport -ShowFilter -FilterType select
        )
        New-UDTable -Id 'firewall_table' -Data $ReportOutput -Columns $Columns -Title 'Rules' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
            $Item = $EventData
            Show-UDToast -Message "$($Item | out-string)"
        }
        New-UDButton -Text "GET Rows" -OnClick {
            $value = Get-UDElement -Id "firewall_table"
            Show-UDToast -Message "$( $value.selectedRows | Out-String )"
        }
}

this is working for my, on what version of ud and psu you are using ?
from where the data comes ?

You gave me a clue when you were converting the properties to string. I did that and it worked perfectly.

It’s a custom object. I’m creating it based on what I find on different servers.

this new functionality in tables works beautifully.

1 Like

Glad it worked for you