Skip to content

Instantly share code, notes, and snippets.

@McAndersDK
Created April 6, 2021 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McAndersDK/5749f64e47c723a3f278550da53736cb to your computer and use it in GitHub Desktop.
Save McAndersDK/5749f64e47c723a3f278550da53736cb to your computer and use it in GitHub Desktop.
New-UDGrid -Title 'Grid' -Id 'GridId' -Endpoint {
#$data = Import-Clixml loaddata.xml
$Data = New-Object pscustomobject -Property @{
'ItemColumn' = 'Value'
}
$ColumnActions = @{n = "Actions"; e = { New-UDButton -Id "$($_.ItemColumn)Delete" -Text 'Delete' -OnClick {
$Clickeditem = $_.ItemColumn
(Import-Clixml loaddata.xml | Where-Object ItemColumn -ne $Clickeditem ) | Export-Clixml loaddata.xml
Sync-UDElement -id 'GridId' -broadcast
}
}
}
$Data | Select-Object 'ItemColumn', $ColumnActions | Out-UDGridData
} -Headers @('ItemColumn', 'Actions') -Properties @('ItemColumn', 'Actions')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment