> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/de/powershell-befehle/new-udtable.md).

# New-UDTable

### Übersicht

Erstellt eine Tabelle.

### Syntax

```powershell
New-UDTable [-Id <String>] [-Title <String>] [-Data <Object[]>] [-Columns <Hashtable[]>] [-OnRowSelection <Endpoint>] [-ShowSort] [-ShowFilter] [-ShowSearch] [-Dense] [-ShowExport] [-StickyHeader] [-PageSize <Int32>] [-PageSizeOptions <Int32[]>] [-PaginationLocation <String>] [-ShowSelection] [-ShowPagination] [-Padding <String>] [-Size <String>] [-TextOption <Hashtable>] [-ExportOption <String[]>] [-OnExport <Endpoint>] [-DisablePageSizeAll] [-DefaultSortDirection <String>] [-HideToggleAllRowsSelected] [-DisableMultiSelect] [-DisableSortRemove] [-Icon <Hashtable>] [-ClassName <String>] [-ShowRefresh] [-ToolbarContent <ScriptBlock>] [-OnRowExpand <ScriptBlock>] [-MaxHeight <Int32>] [-Language <String>] [-RemoveCard] [-OnRowStyle <ScriptBlock>] [-HeaderStyle <Hashtable>] [-InitialState <Hashtable>] [<CommonParameters>]

    New-UDTable [-Id <String>] [-Title <String>] -LoadRows <Endpoint> [-Columns <Hashtable[]>] [-OnRowSelection <Endpoint>] [-ShowSort] [-ShowFilter] [-ShowSearch] [-Dense] [-ShowExport] [-StickyHeader] [-PageSize <Int32>] [-PageSizeOptions <Int32[]>] [-PaginationLocation <String>] [-ShowSelection] [-ShowPagination] [-Padding <String>] [-Size <String>] [-TextOption <Hashtable>] [-ExportOption <String[]>] [-OnExport <Endpoint>] [-DisablePageSizeAll] [-DefaultSortDirection <String>] [-HideToggleAllRowsSelected] [-DisableMultiSelect] [-DisableSortRemove] [-Icon <Hashtable>] [-ClassName <String>] [-ShowRefresh] [-ToolbarContent <ScriptBlock>] [-OnRowExpand <ScriptBlock>] [-MaxHeight <Int32>] [-AutoRefresh] [-AutoRefreshInterval <Int32>] [-Language <String>] [-RemoveCard] [-OnRowStyle <ScriptBlock>] [-HeaderStyle <Hashtable>] [-InitialState <Hashtable>] [<CommonParameters>]
```

### Beschreibung

Erstellt eine Tabelle. Tabellen werden verwendet, um sowohl statische als auch dynamische Daten anzuzeigen. Sie können Spalten und Daten definieren, die in der Tabelle angezeigt werden sollen. Die Spalten können verwendet werden, um benutzerdefinierte Komponenten basierend auf Zeilendaten zu rendern. Sie können außerdem Paging, Filterung, Sortierung und sogar serverseitige Verarbeitung aktivieren.

### Parameter

#### -Id

Die ID der Komponente. Standardmäßig eine zufällige GUID.

```
Required?                    false
Position?                    named
Default value                [Guid]::NewGuid().ToString()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Title

Der Titel, der oben auf der Karte der Tabelle angezeigt wird.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Data \<Object\[]>

Die Daten, die in die Tabelle eingefügt werden sollen.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -LoadRows

Bei Verwendung dynamischer Tabellen wird dieser Skriptblock aufgerufen. Der Parameter $Body enthält eine Hashtable mit den folgenden Optionen:

```
    filters: @()
    orderBy: string
    orderDirection: string
    page: int
    pageSize: int
    properties: @()
    search: string
    totalCount: int

    You can use these values to perform server-side processing, like SQL queries, to improve the performance of large grids.

    After processing the data with these values, output the data via Out-UDTableData.
```

```
Required?                    true
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Columns \<Hashtable\[]>

Definiert die Spalten, die in der Tabelle angezeigt werden sollen. Verwenden Sie New-UDTableColumn, um diese Spalten zu definieren. Wenn dieser Parameter nicht angegeben wird, werden die Eigenschaften der übergebenen Daten zu den Spalten.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnRowSelection

Ein Skriptblock, der aufgerufen wird, wenn eine Zeile ausgewählt wird. $EventData enthält die ausgewählten Zeilen.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowSort [<SwitchParameter>]
        Whether to show sort controls on columns

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowFilter [<SwitchParameter>]
        Whether to show filter controls on columns

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowSearch [<SwitchParameter>]
        Whether to show full table search

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -Dense [<SwitchParameter>]
        Reduces the white-space used within the table.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowExport [<SwitchParameter>]
        Whether to show the export button.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -StickyHeader [<SwitchParameter>]
        Makes the header sticky.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -PageSize

Die Standard-Seitengröße.

```
Required?                    false
Position?                    named
Default value                5
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -PageSizeOptions \<Int32\[]>

Ein Array der verfügbaren Seitengrößenoptionen.

```
Required?                    false
Position?                    named
Default value                @()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -PaginationLocation

Wo die Paginierungssteuerelemente angezeigt werden sollen. Gültige Werte sind top, bottom oder both. Standardwert ist bottom.

```
Required?                    false
Position?                    named
Default value                bottom
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowSelection [<SwitchParameter>]
        Whether to allow selection within the table.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowPagination [<SwitchParameter>]
        Whether to show pagination controls.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Padding

```
Required?                    false
Position?                    named
Default value                default
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Size

Die Größe der Tabelle. Standardwert ist medium. Gültige Werte sind medium und small.

```
Required?                    false
Position?                    named
Default value                medium
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -TextOption

Anpassungen des Standardtexts innerhalb der Tabelle. Verwenden Sie New-UDTextOption, um die Textoptionen zu erstellen.

```
Required?                    false
Position?                    named
Default value                (New-UDTableTextOption)
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ExportOption \<String\[]>

Ein Array von Exportoptionen.

```
Required?                    false
Position?                    named
Default value                @("XLSX", "PDF", "JSON", "CSV")
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnExport

Ein Skriptblock, mit dem angepasst wird, wie der Export durchgeführt wird.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -DisablePageSizeAll [<SwitchParameter>]
        Removes the All option from page size options.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -DefaultSortDirection

Die Standard-Sortierrichtung.

```
Required?                    false
Position?                    named
Default value                ascending
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -HideToggleAllRowsSelected [<SwitchParameter>]
        Hides the toggle all rows selected button.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -DisableMultiSelect [<SwitchParameter>]
        Disables multi-select.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -DisableSortRemove [<SwitchParameter>]
        Removes the sort option for unsorted columns. Columns will always be ascending or descending.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Icon

Legt ein Symbol neben dem Titel fest. Verwenden Sie New-UDIcon, um das Symbol zu erstellen.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ClassName

Eine CSS-Klasse, die auf die Tabelle angewendet wird.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -ShowRefresh [<SwitchParameter>]
        Whether to show the refresh button.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ToolbarContent

Benutzerdefinierter Inhalt, der in der Symbolleiste angezeigt werden soll.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnRowExpand

Ein Skriptblock, der aufgerufen wird, wenn eine Zeile erweitert wird. Die Variable $EventData enthält die Zeilendaten.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -MaxHeight

```
Required?                    false
Position?                    named
Default value                0
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -AutoRefresh [<SwitchParameter>]
        Reloads the table on an interval when -LoadRows is being used.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -AutoRefreshInterval

Das Intervall zum Neuladen der Daten, wenn AutoRefresh angegeben ist.

```
Required?                    false
Position?                    named
Default value                10
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Language

Die Sprache. Wird primär für Datums- und Zeitfilter verwendet.

```
Required?                    false
Position?                    named
Default value                en
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    -RemoveCard [<SwitchParameter>]

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnRowStyle

Ein Skriptblock, der zum Stylen von Zeilen aufgerufen wird. Die Variable $EventData enthält die Zeilendaten.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -HeaderStyle

Eine Hashtable mit Stilen, die auf die Kopfzeile angewendet werden.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -InitialState

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
```

### Ausgaben

\-------------------------- BEISPIEL 1 --------------------------

```
PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS > New-UDTable -Data $Data -Id 'table1'

Basic Table|Creates a static table whether the columns of the table are the properties of the data specified.




-------------------------- EXAMPLE 2 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "A Dessert"
PS >     New-UDTableColumn -Property Calories -Title Calories
PS >     New-UDTableColumn -Property Fat -Title Fat
PS >     New-UDTableColumn -Property Carbs -Title Carbs
PS >     New-UDTableColumn -Property Protein -Title Protein
PS > )
PS > New-UDTable -Data $Data -Columns $Columns -Id 'table2'

Columns|Creates a table where there are custom columns defined for that table.




-------------------------- EXAMPLE 3 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title Dessert -Render {
PS >        New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert }
PS >     }
PS >     New-UDTableColumn -Property Calories -Title Calories
PS >     New-UDTableColumn -Property Fat -Title Fat
PS >     New-UDTableColumn -Property Carbs -Title Carbs
PS >     New-UDTableColumn -Property Protein -Title Protein
PS > )
PS > New-UDTable -Data $Data -Columns $Columns -Id 'table3'

Render|Creates a table where the columns are rendered with custom content.




-------------------------- EXAMPLE 4 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title Dessert -Render {
PS >         New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert }
PS >     }
PS >     New-UDTableColumn -Property Calories -Title Calories -Width 5 -Truncate
PS >     New-UDTableColumn -Property Fat -Title Fat
PS >     New-UDTableColumn -Property Carbs -Title Carbs
PS >     New-UDTableColumn -Property Protein -Title Protein
PS > )
PS >
PS > New-UDTable -Data $Data -Columns $Columns -Id 'table4'

Column Width|Set custom column width




-------------------------- EXAMPLE 5 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "A Dessert" -Filter -FilterType AutoComplete
PS >     New-UDTableColumn -Property Calories -Title Calories -Filter -FilterType Range
PS >     New-UDTableColumn -Property Fat -Title Fat -Filter -FilterType Range
PS >     New-UDTableColumn -Property Carbs -Title Carbs -Filter -FilterType Range
PS >     New-UDTableColumn -Property Protein -Title Protein -Filter -FilterType Range
PS > )
PS >
PS > New-UDTable -Id 'table5' -Data $Data -Columns $Columns -ShowFilter

Column Filter|Columns filters for a table




-------------------------- EXAMPLE 6 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "A Dessert" -IncludeInSearch
PS >     New-UDTableColumn -Property Calories -Title Calories
PS >     New-UDTableColumn -Property Fat -Title Fat
PS >     New-UDTableColumn -Property Carbs -Title Carbs
PS >     New-UDTableColumn -Property Protein -Title Protein
PS > )
PS >
PS > New-UDTable -Id 'table6' -Data $Data -Columns $Columns -ShowSearch

Column Search|Columns can be included in the search




-------------------------- EXAMPLE 7 --------------------------

PS >$Columns = @(
PS >     New-UDTableColumn -Property Name -Title "Name" -ShowFilter
PS >     New-UDTableColumn -Property Value -Title "Value" -ShowFilter
PS > )
PS >
PS > $Data = 1..1000 | ForEach-Object {
PS > [PSCustomObject]@{
PS >     Name = "Record-$_"
PS >     Value = $_
PS > }
PS > }
PS >
PS > New-UDTable -Columns $Columns -LoadData {
PS >     foreach($Filter in $EventData.Filters)
PS >     {
PS >         $Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
PS >     }
PS >
PS >     $TotalCount = $Data.Count
PS >
PS >     if (-not [string]::IsNullOrEmpty($EventData.OrderBy.Field))
PS >     {
PS >         $Descending = $EventData.OrderDirection -ne 'asc'
PS >         $Data = $Data | Sort-Object -Property ($EventData.orderBy.Field) -Descending:$Descending
PS >     }
PS >
PS >     $Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
PS >
PS >     $Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
PS > } -ShowFilter -ShowSort -ShowPagination -Id 'table7'

Server-Side Processing|Server-side processing is useful for large data sets that should not be loaded into the browser.




-------------------------- EXAMPLE 8 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > New-UDTable -Data $Data -Paging -PageSize 2 -Id 'table8'

Paging|Paging can be enabled by setting the -Paging parameter to $true. The default page size is 10.




-------------------------- EXAMPLE 9 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > New-UDTable -Data $Data -OnRowExpand {
PS >     New-UDAlert -Text $EventData.Calories
PS > } -Columns @(
PS >     New-UDTableColumn -Title 'Dessert' -Property 'Dessert'
PS > ) -Id 'table9'

Row Expansion|Row expansion can be enabled by setting the -OnRowExpand parameter to a scriptblock. The scriptblock will be passed the row data as a hashtable in the $EventData variable.




-------------------------- EXAMPLE 10 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "A Dessert" -IncludeInExport
PS >     New-UDTableColumn -Property Calories -Title Calories  -IncludeInExport
PS >     New-UDTableColumn -Property Fat -Title Fat   -IncludeInExport
PS >     New-UDTableColumn -Property Carbs -Title Carbs   -IncludeInExport
PS >     New-UDTableColumn -Property Protein -Title Protein   -IncludeInExport -Hidden
PS > )
PS >
PS > New-UDTable -Id 'table10' -Data $Data -Columns $Columns -Export

Export|Export table data with the -Export parameter. You can configure which columns are included in the export by setting the -IncludeInExport parameter on the column. Use -Hidden to hide a column from the table but include it in the export.




-------------------------- EXAMPLE 11 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
PS > )
PS >
PS > $Option = New-UDTableTextOption -Search "Search all these records"
PS >
PS > New-UDTable -Data $Data -TextOption $Option -ShowSearch -Id 'table11'

Text Options|Text options can be used to customize the text in the table.




-------------------------- EXAMPLE 12 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
PS > )
PS >
PS > New-UDTable -Data $Data -OnRowStyle {
PS >     if ($EventData.Dessert -eq 'Frozen yoghurt')
PS >     {
PS >         @{
PS >             backgroundColor = "red"
PS >         }
PS >     } else {
PS >         @{}
PS >     }
PS > } -Id 'table12'

Row Styling|You can style rows by using the -OnRowStyle parameter. The script block will be passed the row data as a hashtable in the $EventData variable. The script block should return a hashtable of CSS styles to apply to the row.




-------------------------- EXAMPLE 13 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 1; Protein = 4.0 }
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 34; Protein = 4.0 }
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 73; Protein = 4.0 }
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 25; Protein = 4.0 }
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 99; Protein = 4.0 }
PS > )
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "Dessert"
PS >     New-UDTableColumn -Property Calories -Title "Calories"
PS >     New-UDTableColumn -Property Fat -Title "Fat"
PS >     New-UDTableColumn -Property Carbs -Title "Carbs"  -DefaultSortColumn
PS >     New-UDTableColumn -Property Protein -Title "Protein"
PS > )
PS > New-UDTable -Data $Data -DefaultSortDirection descending -Id 'table13' -ShowSort -Columns $Columns

Default Sort|Set the default sort direction and column.




-------------------------- EXAMPLE 14 --------------------------

PS >$Data = 1..100 | ForEach-Object {
PS >     [PSCustomObject]@{
PS >         Dessert = "Dessert $_"
PS >         Calories = Get-Random -Minimum 100 -Maximum 500
PS >         Fat = Get-Random -Minimum 1 -Maximum 10
PS >         Carbs = Get-Random -Minimum 1 -Maximum 100
PS >         Protein = Get-Random -Minimum 1 -Maximum 100
PS >  }
PS > }
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "Dessert" -ShowFilter
PS >     New-UDTableColumn -Property Calories -Title "Calories"
PS >     New-UDTableColumn -Property Fat -Title "Fat"
PS >     New-UDTableColumn -Property Carbs -Title "Carbs"
PS >     New-UDTableColumn -Property Protein -Title "Protein"
PS > )
PS >  New-UDTable -Id 'table14'  -ShowPagination  -LoadData {
PS >     foreach($Filter in $EventData.Filters)
PS >     {
PS >         $Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
PS >     }
PS >     $TotalCount = $Data.Count
PS >     if (-not [string]::IsNullOrEmpty($EventData.OrderBy))
PS >     {
PS >         $Descending = $EventData.OrderDirection -ne 'asc'
PS >         $Data = $Data | Sort-Object -Property $EventData.orderBy.field -Descending:$Descending
PS >     }
PS >
PS >     $Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
PS >     $Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
PS > } -Columns $Columns -InitialState @{
PS >     pageIndex = 0
PS >     pageSize = 20
PS >     filters = @{
PS >         id = "dessert"
PS >         value = "20"
PS >     }
PS >     orderBy = @{ field = "fat" }
PS > } -ShowSort

Initial state|Set the initial state of the table. This can be used to set the page index, page size, filters, and order by column.




-------------------------- EXAMPLE 15 --------------------------

PS >$Data = @(
PS >     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 1; Protein = 4.0 }
PS >     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 150.0; Carbs = 34; Protein = 4.0 }
PS >     @{Dessert = 'Eclair'; Calories = 159; Fat = 100.0; Carbs = 73; Protein = 4.0 }
PS >     @{Dessert = 'Cupcake'; Calories = 159; Fat = 30.0; Carbs = 25; Protein = 4.0 }
PS >     @{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 99; Protein = 4.0 }
PS > )
PS > $Columns = @(
PS >     New-UDTableColumn -Property Dessert -Title "Dessert"
PS >     New-UDTableColumn -Property Calories -Title "Calories"
PS >     New-UDTableColumn -Property Fat -Title "Fat"
PS >     New-UDTableColumn -Property Carbs -Title "Carbs"  -DefaultSortColumn
PS >     New-UDTableColumn -Property Protein -Title "Protein"
PS > )
PS > New-UDTable -Data $Data -Id 'table14' -Columns $Columns -OnRowStyle {
PS >     if ($EventData.Fat -lt 10) { $Color = 'green' }
PS >     elseif ($EventData.Fat -ge 10 -and $EventData.Fat -lt 50) { $Color = 'Yellow' }
PS >     else { $Color = 'Red' }
PS >     @{ backgroundColor = $Color }
PS > }

Row coloring|Use OnRowStyle to style rows based on the row data.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/de/powershell-befehle/new-udtable.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
