TiX
August 18, 2020, 1:39pm
1
Hi all,
I will upgrade my UniversalDashboard to V3. But how can I convert a UDGrid like these in a UDTable in V3?
New-UDGrid -Title "Mitarbeiter zur Weiterberechnung hinzufuegen" -PageSize 3 -NoExport -FilterText "Mitarbeitername eingeben" -Id "WeiterKostHinzuID" -Headers @(" ", "Name", "Tochtergesellschaft") -Properties Hinzufuegen, Name, Company -Endpoint {
$Objects2 = Get-ADUser -Filter {(enabled -eq "true" -and ExtensionAttribute1 -notlike "*")} -Properties Displayname, Company, SamAccountName, ExtensionAttribute1 | Sort-Object name
$Objects2 | ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
Displayname = $_.Displayname
SamAccountName = $_.SamAccountName
Company = $_.Company
Hinzufuegen = New-UDButton -Floating -Icon plus -OnClick {
Set-ADUser -Identity "$($_.SamAccountName)" -Add @{extensionAttribute1="berechnen"}
Set-ADUser -Identity "$($_.SamAccountName)" -Add @{extensionAttribute2="AD"}
Show-UDToast -Message "$($_.Name) hinzugefuegt" -Duration 5000
Sync-UDElement -Id "WeiterKostID"
Sync-UDElement -Id "WeiterKostHinzuID"
}
}
} | Out-UDGridData
}
Thanks !!!
raymix
August 18, 2020, 8:46pm
2
Hi, @TiX
There are some great examples here and source code for that page here , hope that helps.
I’d made a new post here - I’m not a developer by any means, but having said that I’m struggling to migrate to v3 big time.
Hi guys, I know this question has been asked several times but the examples and source code aren’t providing any clarity on a migration path to v3. The biggest frustration seems to be around how to move from server-side processing where we run powershell cmdlets and pump the output to Out-UDGridData. If anyone could provide an example of migrating the following code (I’ve built this from scratch to include the components I’m reading other people struggling with) I think it would help several p…
Did you figure this out @TiX ?
TiX
September 15, 2020, 2:36pm
6
I am a few steps further, data are displayed and paging is working, but i still have problems with sorting and filtering. I have tried different things, but until now its not working. How do I put in this code correct filtering and sorting?
Can someone help me? Thanks a lot!!
New-UDTable -Title 'AD Computer' -LoadData {
$TableData = ConvertFrom-Json $Body
$PageSize = $TableData.PageSize
$Offset = $TableData.Page * $PageSize
$Nxtrow = $offset + 5
$count = (Get-ADComputer -Filter {(Name -like "NB-*")}).count
$Data = (Get-ADComputer -Filter {(Name -like "NB-*")} -Properties @("Name", "Description", "IPv4Address", "OperatingSystem"))[$Offset..$Nxtrow] | ForEach-Object {
@{
name = $_.name
description = $_.description
ipv4address = $_.ipv4address
operatingsystem = $_.operatingsystem
}
}
$Data | Out-UDTableData -Page $TableData.page -TotalCount $count -Properties $TableData.properties
} -Columns @(
New-UDTableColumn -Property 'Name' -Sort $true -Filter $true
New-UDTableColumn -Property 'Description' -Sort $true -Filter $true
New-UDTableColumn -Property 'IPv4Address' -Sort $true -Filter $true
New-UDTableColumn -Property 'OperatingSystem' -Sort $true -Filter $true
) -Sort -Filter
TiX
October 12, 2020, 12:58pm
7
Does somebody has any idea?
adam
October 12, 2020, 2:50pm
8
I don’t see any filtering or sorting code in your example code. Can you show what you have tried?
Have you seen this blog post that goes into detail about the sorting and filtering?
1 Like