I’m trying to implement a server-side table as described in this link: Build Server-Side tables with PowerShell Universal Dashboard
The table doesn’t render in the Dashboard and I can see there is a “ConvertTo-FlatObject” cmdlet in the function that is complaining about a null object.
Here is the code:
$Body = ’
{
“filters”: [],
“orderBy”: “undefined”,
“orderDirection”: “”,
“page”: 0,
“pageSize”: 5,
“properties”: [
“[“SamAccountName””,
““Name”]”
],
“search”: “”,
“totalCount”: 0
}
’
$tabledata = $body | ConvertFrom-Json
New-UDTable -Title “Account Data” -LoadData {
$AccountData | Out-UDTableData -Page $TableData.page -TotalCount $AccountData.Count -Properties $tabledata.properties
} -Columns @(
New-UDTableColumn -Property “SamAccountName”
New-UDTableColumn -Property “Name”
)
Here is the error in VS Code:
ConvertTo-FlatObject: C:…\UniversalDashboard\3.3.3\UniversalDashboard.MaterialUI.psm1:4322:51
Line |
4322 | … data = [Array]($Data | ConvertTo-FlatObject)
| ~~~~~~~~~~~~~~~~~~~~
| Cannot bind argument to parameter ‘InputObject’ because it is null.
But it appears to have created the table:
Name Value
showSort False
loadData UniversalDashboard.Models.Endpoint
assetId
showExport False
userPageSize 5
type mu-table
isPlugin True
size medium
userPageSizeOptions {5, 10, 20, 50}
showSelection False
padding default
data
showFilter False
textOption {exportFileName, filterSearch, exportAllJson, exportAllCsv…}
defaultSortColumn
id 6e5ea472-861c-46d2-a187-8c149c6060da
columns {f7e52421-17bb-46a9-a2d1-eeb93a4f6927, 76b4e9fb-07c8-446a-a9ca-8c9a94567d37}
showSearch False
title Account Data
showPagination False
isDense False
isStickyHeader False
onRowSelection
exportOption {XLSX, PDF, JSON, CSV}
I’m running 1.5.14… Any ideas?
Thanks