EvotecIT / PSWriteHTML

PSWriteHTML is PowerShell Module to generate beautiful HTML reports, pages, emails without any knowledge of HTML, CSS or JavaScript. To get started basics PowerShell knowledge is required.
MIT License
826 stars 106 forks source link

Fixes EvotecIT/PSWriteHTML#241 #242

Closed jasonrush closed 3 years ago

jasonrush commented 3 years ago

Allows specifying multiple columns to sort by (-DefaultSortOrder Descending,Ascending,Descending), and fixed formatting bugs (-ne - 1 vs -ne -).

I have not tested/verified this code, but believe this is a viable solution/route if nobody has any better suggestions.

PrzemyslawKlys commented 3 years ago

Had to do small improvements and fixed translation from Ascending to asc, descending to dsc.

PrzemyslawKlys commented 3 years ago

Tested with following code:

$PRocess = @(
    [PSCustomObject] @{ PRI = 1; ID =   7; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 1; ID =   5; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 2; ID =   4; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 2; ID =   2; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 3; ID =   1; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 3; ID =   6; Text = "Placeholder Text" }
    [PSCustomObject] @{ PRI = 3; ID =   3; Text = "Placeholder Text" }
)

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\DashboardEasy01.html -Show {
    Table -DataTable $Process -DefaultSortIndex 2 -ScrollCollapse -HideFooter -Buttons @()

    Table -DataTable $Process -DefaultSortColumn 'PRI' -ScrollCollapse -HideFooter -Buttons @()

    Table -DataTable $Process -DefaultSortColumn 'ID' -DefaultSortOrder Descending -ScrollCollapse -HideFooter -Buttons @()

    Table -DataTable $Process -DefaultSortColumn 'PRI', 'Id' -DefaultSortOrder Descending, Ascending -ScrollCollapse -HideFooter -Buttons @()

    Table -DataTable $Process -DefaultSortColumn 'PRI', 'Id' -DefaultSortOrder Descending, Descending -ScrollCollapse -HideFooter -Buttons @()
} -Online