Hello,
I would like to get the $EventData.name value from the page Data in the -OnChange of the New-UDDatePicker element but it seems not possible. I understand that the New-DatePicker overwrites the initial $EventData with all the values in it, in its scope by the date picked (which is not the case for all the function such as New-Button and its -Onclick event where i still have acces to my $EventData).
I would like to know if there is a way to do what i’m trying in order to pass theses 2 arguments to my api. thank you !
$pages = @()
$date = Get-Date
$pages += new-UDPage -Name "page" -Content {
$request = (invoke-WebRequest http://api).Content | ConvertFrom-Json
$Data = @()
$count = 0
$request | ForEach {
$Data += @{
'name' = $_.name
'expired_date' = ($_.AccountExpirationDate).ToString("yyyy-MM-dd")
'id' = $count
}
$count++
}
$Columns = @(
New-UDTableColumn -Property "Prolong" -Title "Prolongation" -OnRender {
new-UDDatePicker -MinimumDate $date.AddDays(1) -OnChange{
show-UDToast -Message "$($EventData.name) enable until $EventData" -Duration 3000
}
}
)
new-UDTable -Data $Data -Id "table1" -Columns $Columns -Paging -PageSize 5
} -Url "/api/:data"
New-UDApp -Pages $pages
Show-UDToast returns the date but not the user name