Context: Im trying to have a datagrid within the row expansion of a table. Currently when I expand the table, it populates properly but I get errors about $EventData not having -first, -skip, or -page properties. I assume this is from the datagrid overwriting the $EventData variable, but Im unsure of the best way to handle this.
New-UDTable -Columns $Columns -LoadData {
$data = $ADSGroups
foreach($Filter in $EventData.Filters)
{
$Data = $ADSGroups | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
}
if ($EventData.Search)
{
$Data = $Data | Where-Object { $_.Name -match $EventData.Search -or $_.Value -match $EventData.Search }
}
$TotalCount = $Data.Count
if (-not [string]::IsNullOrEmpty($EventData.OrderBy.Field))
{
$Descending = $EventData.OrderDirection -ne 'asc'
$Data = $Data | Sort-Object -Property ($EventData.orderBy.Field) -Descending:$Descending
}
$Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
$Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
} -ShowFilter -ShowSort -ShowPagination -OnRowExpand {
New-UDDynamic -Content {
$guid = $EventData.uri.split("/")[-1]
$groupmembers = get-adgroup $guid
New-UDDataGrid -loadrows {
$data= $groupmembers
$data | Out-UDDataGridData -Context $EventData -TotalRows $groupmembers.count
} -columns @(New-UDDataGridColumn -Field uid -Render {$AccountHash[$EventData.uid]} -flex 5) -AutoPageSize -Density compact
}
}
Product: PowerShell Universal
Version: 4.2.0