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

New-TableButtonCSV is not working in a script #416

Closed crimsonread closed 3 months ago

crimsonread commented 1 year ago

Hello,

At a new version of this module, I found that table button is not working when I include New-TableButtonCSV in the script.

$data = Get-Process | Select-Object Name,WorkingSet,Id,VirtualMemorySize,CPU
New-HTML -HtmlData {

New-HTMLTable -DataTable $data -HideFooter -PagingLength 30 -HTML {
    New-TableButtonCopy
    New-TableButtonColumnVisibility
    New-TableButtonCSV
    New-TableCondition -Name Name -ComparisonType string -Operator eq -Value teams -Color BlueViolet -BackgroundColor MoonYellow -Row
    New-TableCondition -Name Name -ComparisonType string -Operator like -Value svc -Color White -BackgroundColor Green

 }
} -ShowHTML

On the other hand, table button is working if I do not include New-TableButtonCSV

$data = Get-Process | Select-Object Name,WorkingSet,Id,VirtualMemorySize,CPU
New-HTML -HtmlData {

New-HTMLTable -DataTable $data -HideFooter -PagingLength 30 -HTML {
    New-TableButtonCopy
    New-TableButtonColumnVisibility
    New-TableCondition -Name Name -ComparisonType string -Operator eq -Value teams -Color BlueViolet -BackgroundColor MoonYellow -Row
    New-TableCondition -Name Name -ComparisonType string -Operator like -Value svc -Color White -BackgroundColor Green

 }
} -ShowHTML
PrzemyslawKlys commented 10 months ago

I can't reproduce your issue:

$data = Get-Process | Select-Object Name, WorkingSet, Id, VirtualMemorySize, CPU -First 10
New-HTML -HtmlData {

    New-HTMLTable -DataTable $data -HideFooter -PagingLength 30 -HTML {
        New-TableButtonCopy
        New-TableButtonColumnVisibility
        New-TableButtonCSV
        New-TableCondition -Name Name -ComparisonType string -Operator eq -Value teams -Color BlueViolet -BackgroundColor MoonYellow -Row
        New-TableCondition -Name Name -ComparisonType string -Operator like -Value svc -Color White -BackgroundColor Green

    }
} -ShowHTML

image

crimsonread commented 10 months ago

Hello,

The version of module is 1.12.0 for testing. The result looks like below.

Screenshot 2023-12-02 080430

PrzemyslawKlys commented 10 months ago

Try the prerelease version which is 1.13.0. Maybe it will help.

crimsonread commented 10 months ago

Try the prerelease version which is 1.13.0. Maybe it will help.

Hello,

Okay, 1.13.0 solved the issue. However, it made other issue on New-TableCondition which is not working at all.

$data = Get-Process | Select-Object Name, WorkingSet, Id, VirtualMemorySize, CPU
New-HTML -HtmlData {

    New-HTMLTable -DataTable $data -HideFooter -PagingLength 30 -HTML {
        New-TableButtonCopy
        New-TableButtonColumnVisibility
        New-TableButtonCSV
        New-TableCondition -Name Name -ComparisonType string -Operator eq -Value pwsh -Color BlueViolet -BackgroundColor MoonYellow -Row

    }
} -ShowHTML

sgA7A5hm0a

PrzemyslawKlys commented 10 months ago

Try newest version. It's because of the change to ConvertTo-Json

crimsonread commented 10 months ago

Try newest version. It's because of the change to ConvertTo-Json

Great!. It is working now. Thanks.