I am trying to import a csv and group the content by count which all works fine. Then I would like to be able to click on a new button to view the devices for example:
Instagram | 20 installs | Button [View Devices with app installed]
When I click the button it just loads the header and never loads the data. Here is my code am I doing something wrong?
New-UDGrid -Title "Apps" -FontColor black -Headers @("Name", "# of Installs","View Devices") -Properties @("Name", "count","ViewDevices") -Endpoint {
Import-Csv 'C:\Dashboard\AppsInstalled.csv' -Delimiter "," |
Group-Object -Property Name |
Select-Object Name,Count |
ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
username = $_.username
count = $_.count
ViewDevices = New-UDButton -Text "View Devices" -OnClick (New-UDEndpoint -Endpoint {
Show-UDModal -Content {
New-UDTable -Title "Users with Application Installed" -Headers @("Name", "Username") -Content {
Import-Csv 'C:\Dashboard\AppsInstalled.csv' -Delimiter "," | Where-object {$_.Name =$_.Name} | Out-UDTableData -Property @("Name", "Username")
}
}
} -ArgumentList[0])
}
} | Out-UDGridData
}