New-UDtable with custom button column

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 :frowning: please help.
thanks.

You need to use the -Render parameter of New-UDTableColumn for sure. Here’s an example that displays a modal.

$Data = @(
    @{Dessert = 'Frozen yoghurt'; Calories = 1; Fat = 6.0; Carbs = 24; Protein = 4.0}
    @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
    @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
    @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
    @{Dessert = 'Gingerbread'; Calories = 200; Fat = 6.0; Carbs = 24; Protein = 4.0}
) 

$Columns = @(
    New-UDTableColumn -Property Dessert -Title Dessert -Render { 
        New-UDButton -Text "Click for Dessert!" -OnClick { Show-UDModal -Content { $EventData.Dessert }} 
    }
    New-UDTableColumn -Property Calories -Title Calories 
    New-UDTableColumn -Property Fat -Title Fat 
    New-UDTableColumn -Property Carbs -Title Carbs 
    New-UDTableColumn -Property Protein -Title Protein 
)

New-UDTable -Data $Data -Columns $Columns -Sort -Export

Here’s the result.

What happens when you do use the -Render parameter?