New-UDTable Formatting

Product: PowerShell Universal
Version: 2.5.4
UniversalDashboard Module: 3.8.0
UniversalDashboard.Style Module: 1.0.0

How can I apply the following formatting to a UDTable?

  1. Bold Column headers or modify background of column headers
  2. Freeze column headers in UDTable when scrolling page (-StickyHeader parameter is not working)
  3. Color cells in UDTable based on value
$AllData = Import-CSV C:\Temp\Data.csv

$Columns = @(
New-UDTableColumn -Property HypervisorHost -Title "HypervisorHost "
New-UDTableColumn -Property SCVMMAgent -Title "SCVMMAgent"
New-UDTableColumn -Property LastBootUpTime-Title "LastBootUpTime"
New-UDTableColumn -Property OverallHealth -Title "OverallHealth"
)

New-UDTable -Data $AllData -Columns $Columns -ShowSort -StickyHeader

@adam I have a UDTable I’m adding a UDCard to in one column. I’d like to color the card based upon the property value (if the property contains “HEALTHY” then color the card green, if “WARNING” color it yellow etc.)

I’ve tried using the example from the UD-Style page GitHub - ironmansoftware/ud-style: Emotion support for Universal Dashboard but it’s not working correctly. I can get the background to color hotpink but the actual card is not changing colors or accepting any desired, added styles. Any ideas?

I have found that using the UDAlert cmdlet works, but not UDCard when following the example in the link above


The following works successfully with UDAlert:

New-UDStyle -Style '.MuiAlert-standardSuccess {background-color: green;}' -Content {New-UDAlert -Text "TestingAlert"}

That example was from the previous version of UD so I think that’s why it doesn’t work.

try:

New-UDStyle -Style '.MuiCard-root {background-color: green;}' -Content {New-UDCard -Content { "TestingCard" }}

Here’s are the classes that are applied to cards.

Awesome! That did the trick @adam, Thanks!

For the other inquiries for styling the headers and freezing them when scrolling, are those going to be released in future versions? I saw a couple features in the works for 2.6.0

Also, thanks for including the classes!
Drew

I’ve opened a couple issues for those requests. They weren’t in the backlog already.

1 Like