hi,
Building on this example: https://docs.powershelluniversal.com/dashboard/components/data-display/table#table-with-custom-column-rendering
If I use New-UDSwitch instead of New-UDButton, the modal does not display on change.
$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 1; Fat = 6.0; Carbs = 24; Protein = 4.0 }
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
@{Dessert = 'Gingerbread'; Calories = 200; Fat = 6.0; Carbs = 24; Protein = 4.0 }
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title Dessert -Render {
New-UDSwitch -Id "switch$($EventData.Dessert)" -OnChange { Show-UDToast -Message $EventData.Dessert }
}
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -Data $Data -Columns $Columns -Sort -Export
In the code above, this toast also doesn’t display:
Show-UDToast -Message (Get-UDElement -Id "switch$($EventData.Dessert)").checked
In the code above, a simple text toast works and does display ‘test’:
Show-UDToast -Message "test"
PowerShell Universal
Version: 1.5.9
UniversalDashboard [3.1.3]
I’m running a bit behind on versions because the dashboard is in production for users and I want to avoid breaking things… but it’s on the planning to upgrade, test and then upgrade production.
PS: @adam if you are interested, I can show you or your peers of choice with a screen share how I’m using your excellent framework. Send me a mail or pm to agree on a date and time.
Product: PowerShell Universal
Version: 1.5.9