[edit] seems this was reported as a bug here : Can't apply ID on Table Inside Dynamic Region
[/edit]
odd problem here. just trying to have a button to add items to a data table, and then another to show which has been selected. should be simple, however if the datatable has an ID set, no data can be added to the table, remove this and data can be added, but then cannot be got with get-udelement.
New-UDPage -Title “grid” -name “grid” -url “/grid”-Content {
$Session:Data = @(
@{SMTP = ‘fsh@goo.com’; Type=“smtp”}
@{SMTP = ‘sm@ho.com’; Type = “SMTP”}
)
#data will not be added to the table unless the table ID is removed
New-UDButton -text "add data "-OnClick {
$Session:DATA+= @{SMTP = ‘Gingerbread@loo.com’; Type = “SIP”}
Sync-UDElement -Id ‘dyn’
}
#data will be retreived from the table, but data cannot be added
New-UDButton -Text “GET Rows” -OnClick {
$value = Get-UDElement -Id “dt”
Show-UDToast -Message “$( $value)”
}
$Columns = @(
New-UDTableColumn -Property SMTP -Title SMTP
New-UDTableColumn -Property Type -Title Type
)
#in this config data can be retreived and not added
#remove id “dt” and data will be added - but then you cannot get the selected rows
New-UDDynamic -Id “dyn” -Content {
New-UDTable -Data $Session:Data -Columns $Columns -Sort -Export -ShowSelection -id “dt”
}
}
Product: PowerShell Universal
Version: 1.4.6