PSWriteHTML icon indicating copy to clipboard operation
PSWriteHTML copied to clipboard

New-TableButtonCSV is not working in a script

Open crimsonread opened this issue 2 years ago • 6 comments

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

crimsonread avatar Oct 01 '23 09:10 crimsonread

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

PrzemyslawKlys avatar Dec 01 '23 13:12 PrzemyslawKlys

Hello,

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

Screenshot 2023-12-02 080430

crimsonread avatar Dec 01 '23 23:12 crimsonread

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

PrzemyslawKlys avatar Dec 02 '23 16:12 PrzemyslawKlys

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

crimsonread avatar Dec 04 '23 02:12 crimsonread

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

PrzemyslawKlys avatar Dec 04 '23 07:12 PrzemyslawKlys

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

Great!. It is working now. Thanks.

crimsonread avatar Dec 05 '23 02:12 crimsonread