Hello,
After updating from 2.10.2 to 2.12.2, I have an issue with the New-UDTableColumn - Render not rendering properly anymore, and I cannot seem to fix it easily.
The error is:
Exception calling “InvokeWithContext” with “2” argument(s): “The ‘New-UDButton’ command was found in the module ‘UniversalDashboard’, but the module could not be loaded. For more information, run ‘Import-Module UniversalDashboard’.”
The strange thing is, the first Table does render properly, but the second/other tables do not.
Almost like it has trouble accessing the array with Columns that is call again.
Code Excerpts - Columns.
If I remove most of the Column Render code, and only want to generate the button, its still the same error.
$ColumnsEOLCore = @(
New-UDTableColumn -Property Name -Title "Name" -Truncate
New-UDTableColumn -Property EOLDate -Title "End of Life"
New-UDTableColumn -Property Years -Align center
New-UDTableColumn -Property months -Align center
New-UDTableColumn -Property Computers -Align center -Render{
#Show-UDToast $EventData.Name -Duration 8000
$Computers = (Calling some process here getting a list of computers, removed for security reasons)
if($Computers)
{
$ComputersCount = $Computers.Count
}else{
$ComputersCount = '0'
}
#New-UDTypography -Text $ComputersCount
#Clickable button
#Show-UDToast $ComputersCount -Duration 8000
New-UDButton -Text $ComputersCount -Variant text -Style @{all="unset"} -OnClick{
Show-UDModal -Content{
foreach($computer in $Computers)
{
New-UDParagraph -Text $computer
}
}-Footer{
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
}
}
}
)
Code Excerpts - Card
Code of the UDCard calling the charts and tables.
New-UDCard -Title "End of Life Software Tracking - Core Software" -Content{
New-UDRow {
New-UDColumn -LargeSize 4 -Content {
New-UDCard -Style $CardChartStyle -Title "Windows - Client" -Content{
CreateChartv2 -Type horizontalbar -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Windows" })
}
New-UDDynamic -Id "preloader" -Content {
New-UDCardBody -Style @{display = "inherit"} -Content{
New-UDStyle -Style '
.MuiTableCell-head {
background-color: #1f207b;
color: #ffffff;
}
' -Content{
New-UDTable -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Windows" }) -Columns $ColumnsEOLCore
}
}
} -LoadingComponent {
New-UDProgress -Circular -ProgressColor Orange -Size large
New-UDTypography -Text "Retrieving PDQ Numbers.." -Variant overline
}
New-UDCard -Style $CardChartStyle -title "Windows - Server" -Content{
CreateChartv2 -Type horizontalbar -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Windows Server" })
}
New-UDDynamic -Id "preloader2" -Content {
New-UDCardBody -Style @{display = "inherit"} -Content{
New-UDStyle -Style '
.MuiTableCell-head {
background-color: #1f207b;
color: #ffffff;
}
' -Content{
New-UDTable -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Windows Server" }) -Columns $ColumnsEOLCore
}
}
}-LoadingComponent {
New-UDProgress -Circular -ProgressColor Orange -Size large
New-UDTypography -Text "Retrieving PDQ Numbers.." -Variant overline
}
}
New-UDColumn -LargeSize 4 -Content {
New-UDCard -Style $CardChartStyle -Title "Office" -Content{
CreateChartv2 -Type horizontalbar -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Office" })
}
New-UDDynamic -Id "preloader3" -Content {
New-UDCardBody -Style @{display = "inherit"} -Content{
New-UDStyle -Style '
.MuiTableCell-head {
background-color: #1f207b;
color: #ffffff;
}
' -Content{
New-UDTable -Data ($ArrayHTablesEOLCore | Where-Object { $_.Category -eq "Office" }) -Columns $ColumnsEOLCore
}
}
}-LoadingComponent {
New-UDProgress -Circular -ProgressColor Orange -Size large
New-UDTypography -Text "Retrieving PDQ Numbers.." -Variant overline
}
}
}
}
I noticed in the Changelog of 2.11.0:
Dashboards: Improved performance of New-UDTableColumn -Render , maybe it has something to do with that change?
Frontend View:
I’m new to the forums, first post.
Thanks in advance,
Nocturn
Product: PowerShell Universal
Version: 2.12.2