I have a simple table with two columns topic
and type
which are built on data from a sql query. I want to present the data in a New-UDTable
but add a 3rd column for a button. I am struggling with how to either either add the button to each row of the datarow/array object or dynamically add it in with the columns flag. I’ve tried a few things but am really rusty on my PS and didn’t have luck getting things to work.
Here’s the code I currently have:
$datarows = Invoke-SqlCmd -ServerInstance "localhost" -Database "optimizer" -Query "SELECT DISTINCT topic, type FROM topics"
$columns = @(New-UDTableColumn -Property "Edit" -Title "Edit" -Render {
New-UDButton -Text "Click to do something!!"
}
New-UDTableColumn -Property "topic" -Title "topic"
New-UDTableColumn -Property "type" -Title "type"
)
New-UDTable -Data $datarows -columns $columns -Search -PageSize 10
If I simply use $datarows
in New-UDTable
I get the 2 column table fine but I’m uncertain how to get that button to also show up
Any help would be greatly appreciated! Love the new features in UD, it’s been awhile since I took a look at it!