Issue with Render in a Column

I’m building a dashboard to lookup users and wanted a button to click to show the user details in a modal. The issue is sometimes when the table loads the button is not able to get the $EventData.PersonID, even though the previous column is just PersonID. If I refresh the page it typically thene shows, it’s very inconsistent. Is my assumption that the first column showing the personID means that the render should “always” work as well?

$Columns = @(
        New-UDTableColumn -Property PersonID -Title "User Number"  -ShowSort -Filter -FilterType text
        New-UDTableColumn -Property PersonIDbtn -Title "Details" -Render {
            if($EventData.PersonID)
                {
                    $buttonText = "Details"
                }
            else
                {
                    $buttonText = "Error"
                }
            New-UDButton -Id "btnPersonID$($EventData.PersonID)" -Text "$buttonText" -OnClick { 
				Show-UDModal -Content {  
					New-UDTypography -Id 'detailsHeader' -Text "User:  $($currentUserData.FirstName) $($currentUserData.LastName) - $EventData.PersonID" 
					}
				}
			}
			)
Product: PowerShell Universal
Version: 3.10.5

Screenshot 2024-04-10 at 7.12.54 PM
Screenshot 2024-04-10 at 7.13.12 PM
Screenshots of the dashboard, showing that in BOTH cases the data is present, just for some reason $($EventData.PersonID) is rendering as Null in the Render section.

Try storing $EventData in another variable. It might be getting cleared out for some reason in the button handler.

$Columns = @(
        New-UDTableColumn -Property PersonID -Title "User Number"  -ShowSort -Filter -FilterType text
        New-UDTableColumn -Property PersonIDbtn -Title "Details" -Render {
            if($EventData.PersonID)
                {
                    $buttonText = "Details"
                }
            else
                {
                    $buttonText = "Error"
                }
$Person = $EventData 
            New-UDButton -Id "btnPersonID$($EventData.PersonID)" -Text "$buttonText" -OnClick { 
				Show-UDModal -Content {  
					New-UDTypography -Id 'detailsHeader' -Text "User:  $($currentUserData.FirstName) $($currentUserData.LastName) - $Person.PersonID" 
					}
				}
			}
			)

$EventData seems to be cleared in the Render, because the if/else is prior to the button handler.
I tried the code you sent with the same results unfortunately.

Is there a reason to set the ID of the button? I wonder if something is happening there.

-Id "btnPersonID$($EventData.PersonID)"

If you don’t set the ID, it’ll generate a unique GUID and endpoint instead of potentially replacing one.

Removed the Button ID varialbe (I just was doing that as I saw it in the examples) still no go, the render seems to be hit or miss.

Just wanted to follow up, still haven’t been able to get a consistently working dashboard.

Trying to determine if there is a racing condition that is causing this, but the fact that the table data all refreshes, it’s just the button that seems to not render. Do the buttons render before the tables? Since the button is defined in the Column deffinition I would expect the table and button to both render at the same time.