Potential bug in UDTableColumn in 3.0.0 RTM1

I am testing the new beta :slight_smile:

Product: PowerShell Universal
Version: 3.0.0 RTM1

I have a New-UDButton in a New-UDTableColumn that opens a Show-Modal. In version 2.x the $EventData had values, but is blank in the 3.0.0 RTM1 version

Here is my sample code that works in 2.x, but not in 3

    $Data = @(
        @{Dessert = 'Frozen yoghurt'; Calories = 159; 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 = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
    ) 
    
    $Columns = @(
        New-UDTableColumn -Property Dessert -Title Dessert -Render { 
            New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDModal -Header { New-UDHeading -Size 4 -Text $EventData.Dessert } -Content { New-UDHeading -Size 4 -Text $EventData.Dessert } } 
        }
        New-UDTableColumn -Property Calories -Title Calories -Width 5 -Truncate
        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

Is that a bug or change in behavior?

I get something similar @adam and have tested this out moving back to beta7 (one of the later nightly’s) which works fine, but not on RTM1.

It seems the $eventdata does pass through to the UDTableColumn, but then when you do something inside there, like UdButton, or in my case Show-UdModal it loses the $eventdata array. You can test this by putting a toast in straight after the -Render, this toast has the eventdata values, if you then have show-udmodal {show-udtoast…} the $eventdata is missing.

For the moment i have rolled back to beta7 as that works fine for this issue.

I think you can create and use a local variable instead of $eventdata.

$dessert = $EventData.Dessert

We just made a change to Show-UDModal (actually, something going into 2.x as well) that is probably causing this. It’s a bug and I’ll get it fixed.

1 Like

This has been fixed and will be resolved in the next nightly builds.

As an aside, I’m pretty happy with our new UI tests. We’ve been beefing up tests for both the admin console and the dashboard using Playwright. It actually caught this error last night! You just ran into it before I had a chance to check the UI test results :wink:

image

After the fix:

2 Likes