Hey
Im playing around with PSU, but are having some issues understanding the New-UDElement / Set-UDElement / New-UDDynamic
I got this simple PoC, where you can click a computer object:
$TestArray = @()
1..5 | ForEach-Object {
$TestArray += [PSCustomObject]@{
ID = $_
Client = "Computer-$(Get-Random)"
}
}
New-UDDashboard -Title 'All clients' -Content {
New-UDGrid -Container -Content {
New-UDGrid -Item -ExtraSmallSize 6 -Content {
$Columns = @(
New-UDTableColumn -Property ID -Title "ID" -Hidden
New-UDTableColumn -Property Client -Title "Client Name" -ShowFilter -ShowSort
New-UDTableColumn -Property ClientButton -Title "View" -Render {
New-UDButton -Text "View" -OnClick {
Show-UDToast -Message $eventdata.ID
Sync-UDElement -Id 'ClientIDSelection'
}
}
)
New-UDTable -Data $TestArray -Columns $Columns -ShowSort -ShowFilter -PageSize 5 -ShowPagination -Dense
}
}
New-UDDynamic -Id 'ClientIDSelection' -Content {
$SelectedClientId = Get-UDElement -Id ClientIDSelection
Show-UDToast -Message $SelectedClientId
if ($null -ne $SelectedClientId) {
New-UDCard -Title "Test123" -Content {
}
}
}
}
What i want to achieve is, that a new set of grids / cards appear below the client selection, but only once the View button have been pressed & the ID property is then forwarded, so i can use it for querying the data, based on the ID.
I hope you can help me