Product: PowerShell Universal
Version: 3.8.5
Hello all,
Been trying to get this working today, but seem to find conflicting information on how to actually get it working…
Purpose is to have a Table that displays 3 columns, 2 data columns and 1 column with a remove button… I’ve gotten display to work correctly, but can’t seem to find the correct syntax to get the buttons to perform the actual removal of the Row.
Code below.
$tabledata= @(
@{
'Effort' = 'Effort 1'
'Use Case' = 'Account Type 1'
'Remove' = '1'
},
@{
'Effort' = 'Effort 2'
'Use Case' = 'Account Type 1'
'Remove' = '2'
}
)
New-UDDashboard -Title "LDIFF Creation" -Content {
New-UDForm -Content {
New-UDSelect -label "Account Type" -Multiple -Option { foreach($line in $DropDownItems){New-UDSelectOption -Name $line.name -Value $line.value}}
New-UDSelect -label "Effort" -Multiple -Option { foreach($line in $DropDownSubTypes){New-UDSelectOption -Name $line.name -Value $line.value}}
New-UDTextbox -Id 'txtTextField_num' -label "Quantity" -Mask "/^[1-9]$|^0[1-9]$|^1[0-9]$|^20$/" -Unmask
} -OnSubmit {
# Step 4: Define the submit button action
$Page:TestDynamic = $true
$Quantity = $Eventdata.txtTextField_num
$EffortName = $Eventdata.DropdownSubTypes
$AccountType = $EventData.DropdownItems
Sync-UDElement -Id "TestTable"
}
New-UDDynamic -id 'TestTable' -Content {
if($Page:TestDynamic)
{
New-UDTable -Id "dataTable" -Data $TableData -Columns @(
New-UDTableColumn -Property "Effort" -Title "IGA Effort"
New-UDTableColumn -Property "Use Case" -Title "Use Case"
New-UDTableColumn -property 'Remove' -Title "Remove" -Render {
$rowdata = $body | ConvertFrom-Json
$ItemID = $rowdata.Remove
Show-UDToast -Message $ItemID
New-UDButton -Text "Remove" -OnClick {
$tabledata = $TableData| Where-Object { $_.Remove -ne $ItemID }
Sync-UDElement -Id "TestTable"
}
}
)
}
}
}