DavidB
June 29, 2020, 8:51pm
1
Can anyone explain why this V3 Dashboard with a New-UDDynamic does not update as it should? I expect as I click the button, the UDParagraph will update, but I cannot get it to work at all
New-UDPage -Name “Cards” -Content {
$Session:DisplayName = “John Smith”
New-UDDynamic -content {
New-UDCard -Id “Sync” -Title ‘DisplayName Card’ -content {
New-UDParagraph -Text $Session:DisplayName
}
}
New-UDTextbox -Id ‘txtExample’
New-UDButton -OnClick {
$Session:DisplayName = (Get-UDElement -Id ‘txtExample’).value
Show-UDToast -Message $Session:DisplayName
Sync-UDElement -Id “Sync”
} -Text “Get textbox value”
}
adam
June 29, 2020, 9:24pm
2
You need to sync the UDDynamic and not the card.
$Page = New-UDPage -Name “Cards” -Content {
$Session:DisplayName = “John Smith”
New-UDDynamic -Id 'Sync' -content {
New-UDCard -Title ‘DisplayName Card’ -content {
New-UDParagraph -Text $Session:DisplayName
}
}
New-UDTextbox -Id ‘txtExample’
New-UDButton -OnClick {
$Session:DisplayName = (Get-UDElement -Id ‘txtExample’).value
Show-UDToast -Message $Session:DisplayName
Sync-UDElement -Id “Sync”
} -Text “Get textbox value”
}
New-UDDashboard -Title "Hello, World!" -Pages $Page
2 Likes
DavidB
June 30, 2020, 1:06pm
3
God so simple, many thanks I’ve made real progress today.
1 Like