Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.0: breaking changes or issue in buttons when passing variables? #810

Closed
PorreKaj opened this issue May 22, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@PorreKaj
Copy link

commented May 22, 2019

This is a button in a grid, which used to work:

New-UDButton -Text "More" -OnClick (
                                    New-UDEndpoint -Endpoint {
                                        $Employees = Get-ADUser -Filter "Department -like '$($ArgumentList[0]) -*'" -Properties Title,Department,WWWHomePage | Select-object -Property Name,SamAccountname,Title,Department,WWWHomePage
                                        Show-UDModal -Header {
                                            New-UDHeading -Size 4 -Text "Employees in $($ArgumentList[0])"
                                        } -Content { 
                                            
                                            New-UDgrid -Title "Accounts" -Endpoint {
                                                $Employees | Out-UDGridData
                                            }
                                        }
                                    } -ArgumentList $($_.DepartmentNumber) 
                                )

On clicking the grid is blank, but the Modal header correctly displays the department number
I tried switching it up with an -argumentlist on the UDgrid, but am getting a Cannot index into a null array. in the grid

New-UDButton -Text "More" -OnClick (
                                    New-UDEndpoint -Endpoint {
                                        $Employees = Get-ADUser -Filter "Department -like '$($ArgumentList[0]) -*'" -Properties Title,Department,WWWHomePage | Select-object -Property Name,SamAccountname,Title,Department,WWWHomePage
                                        Show-UDModal -Header {
                                            New-UDHeading -Size 4 -Text "Employees in $($ArgumentList[0])"
                                        } -Content { 
                                            
                                            New-UDgrid -Title "Accounts" -Endpoint {
                                                $($ArgumentList[0]) | Out-UDGridData
                                            } -ArgumentList $Employees
                                        }
                                    } -ArgumentList $($_.DepartmentNumber) 
                                )

This works, but i'm not sure if its best practice:

New-UDButton -Text "More" -OnClick (
                                    New-UDEndpoint -Endpoint {
                                        $Session:Employees = Get-ADUser -Filter "Department -like '$($ArgumentList[0]) -*'" -Properties Title,Department,WWWHomePage | Select-object -Property Name,SamAccountname,Title,Department,WWWHomePage
                                        Show-UDModal -Header {
                                            New-UDHeading -Size 4 -Text "Employees in $($ArgumentList[0])"
                                        } -Content { 
                                            
                                            New-UDgrid -Title "Accounts" -Endpoint {
                                                $Session:Employees | Out-UDGridData
                                            }
                                        }
                                    } -ArgumentList $($_.DepartmentNumber) 
                                )
@adamdriscoll

This comment has been minimized.

Copy link
Member

commented May 24, 2019

Reproduced this. Thanks for all the things you tried because it really made it easy for me to get this reproduced in my lab. Looking into it.

adamdriscoll added a commit that referenced this issue May 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.