Product: PowerShell Universal
Version: 1.5.0 (358714472 Thu, 12 Nov 2020 00:35:06 GMT )
Product: Universal Dashboard Latest
Hello,
trying to create a custom column in a UDTable that will open a modal. no luck so far.
anyone managed to do this and willing to share an example ?
basically i have an udtable, the data i get from an sql query, and 5 out of 10 columns i want to show in the table and the rest of 5 i want to show in the modal.
Grid:
column1 | column2 | column3 | column4 | column5 | columnWithModalButton
my code looks like this so far:
$Data = get-oracle 'select * from shopfloor' | Select-Object -Skip 1 | ForEach-Object {
$Row = $_
[PSCustomObject]@{
HOSTNAME = $Row.HOSTNAME #done
IP = if ([DBNull]::Value.Equals($Row.IP)) { #done
"No info"
}
else {
$Row.IP
}
MAC = if ([DBNull]::Value.Equals($Row.MAC)) { #done
"No info"
}
else {
$Row.MAC
}
LINE = if ($line -eq '') { #done
"No info"
}
else {
$line
}
#and more lines from the db
}
}
$Columns = @(
New-UDTableColumn -Property HOSTNAME -Title "Host" -ShowSort -DefaultSortColumn -IncludeInSearch -ShowFilter -FilterType text
New-UDTableColumn -Property IP -Title "IP" -IncludeInExport -ShowFilter -FilterType text
New-UDTableColumn -Property MAC -Title "MAC" -IncludeInExport -ShowFilter -FilterType text
New-UDTableColumn -Property LINE -Title "Line" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter
)
New-UDTable -Id 'shopfloor_comp' -Data $Data -Columns $Columns -Title 'Shopfloor Computers' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
$Item = $EventData
Show-UDToast -Message "$($Item.hostname | out-string)"
} -Export
i’ve tried adding a column like this:
New-UDTableColumn -Property Dessert -Title Dessert -Render {
New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert }
}
i’ve tried adding the button to the custom object and the adding a table column
more = $(New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert })
No luck so far please help.
thanks.