In my Apps, I have a dynamic zone to automatically fill a field.
New-UDDynamic -Id 'idDynLogin' -Content {
if ((Get-UDElement -Id "idTBPrenom").value -and (Get-UDElement -Id "idTBNom").value ) {
$LogonFirstName = (Get-UDElement -Id "idTBPrenom").value
..........
..........
} -AutoRefresh -AutoRefreshInterval 3
I’d like to be able to disable autorefresh with a button or a checkbox, but it doesn’t work.
I used this code to disable autorefresh:
Set-UDElement -Id "idDynLogin" -Properties @{autoRefresh = $False }Product: PowerShell Universal Version 4.2.13
Okay so your problem is you are setting the dynamic area to auto refresh and do it every 3 seconds. Remove the two refresh parameters. Now when you want this dynamic area to display or work you need to call sync-udelement I’ve done a lot of dynamic areas recently and I set a cache variable to a certain value then sync the dynamic area but the dynamic area has an if clause to check the value of the cache variable. Hope this makes sense
ok, I understand the principle, I’ll try that.
Thanks
Hey @jerome02
I also had this need once and resolved it that way:
New-UDSwitch -Id 'AutoRefresh' -Color primary -CheckStyle -Checked $false -OnChange {
Set-UDElement -Id 'myTable' -Properties @{
AutoRefresh = $((Get-UDElement -Id 'AutoRefresh').Checked)
}New-UDTable -Id 'myTable' -LoadData {
[...]
} -AutoRefresh:$((Get-UDElement -Id 'AutoRefresh').Checked) -AutoRefreshInterval $AutoRefreshInterval
That should do the trick. Hope this helps you a little bit.
BR,
Don
thanks