New-UDDataGrid with $data variable

I’m having a similar issue as described here:
https://forums.ironmansoftware.com/t/new-uddatagrid-wont-render-with-custom-datasets/7586/5

I’m trying to use a data grid within a dynamic part. In my production dashboard, I would refresh this data. In the code below, this part es excluded, but the error still occurs. The data is not shown, I’m getting a reload animation forever. Lowercase field did not help.

New-UDDashboard -Title 'PowerShell Universal' -Content {
    $users = @(
        @{
            Name = 'John Doe'
            Age  = 30
        }
        @{
            Name = 'Jane Doe'
            Age  = 29
        }
    )
    
    New-UDDynamic -Id 'Demo' -ArgumentList $users -Content {

            $data2 = $ArgumentList
        
            New-UDDataGrid -LoadRows {
                @{
                    rows     = $data2
                    rowCount = $data2. Length
                }
            } -Columns @(
                @{ field = 'name' }
                @{ field = 'age' }
            ) -AutoHeight -Pagination
    }
}

But if i rename the $data2 to $data, it’s working. Wild guessing: Is there anywhere a hardcoded $data variable in the component? If you could fix that, that would be great.

In addition, the must requirement for lower-case fields in the columns is counter-intuitive for a PowerShell script.

Product: PowerShell Universal
Version: 3.2.0

That is very strange but I’ve opened an issue for both of these items.

1 Like