Product: PowerShell Universal
Version: 4.1.6I would like to pre-populate a table with an initial value. I’m wondering what the best way to accomplish this is?
Right now I do something like:
$ParsedBody = $Body | ConvertFrom-Json -AsHashtable -Depth 99
$ParsedBody = [HashTable]::New($ParsedBody, [StringComparer]::OrdinalIgnoreCase) # fixes case sensitivity introduced in PSv7.3
$ParsedBody.Search ??= 'Test Search'While this works and the results show up as expected, the form fields in the UDTable control are not populated. I’m wondering if there is a way to intercept what is going to New-UDTable, or provide an initial state to New-UDTable.
Ideally, I would like to be able to do something like:
$ParsedBody = $Body | ConvertFrom-Json -AsHashtable -Depth 99
$ParsedBody = [HashTable]::New($ParsedBody, [StringComparer]::OrdinalIgnoreCase) # fixes case sensitivity introduced in PSv7.3
$ParsedBody.Search ??= 'Test Search'
New-UDTable -InitialState $ParsedBodyIf this isn’t something that’s possible right now I can submit a feature request.
This isn’t implemented right now so feel free to open a feature request.
Adam Driscoll
PowerShell Expert and Software Architect at Devolutions
Issue submitted: Allow New-UDTable to support an initial state for form fields · Issue #2779 · ironmansoftware/issues · GitHub