PSWriteHTML icon indicating copy to clipboard operation
PSWriteHTML copied to clipboard

Fix for RowHoverSelect in function New-HTMLTableStyle

Open linefeed1 opened this issue 3 years ago • 7 comments

There appears to be at bug in PSWriteHTML.psm1- v.0.0.180 -> Function New-HTMLTableStyle as RowHoverSelected will show hover on selected item for odd row numbers only - after line 22918 added: 'table.dataTable.hover tbody tr.even:hover.selected, table.dataTable.display tbody tr.even:hover.selected' 'table.dataTable.hover tbody tr.odd:hover.selected, table.dataTable.display tbody tr.odd:hover.selected'

Verification: New-HTMLTableStyle -BackgroundColor Blue -Type RowSelected New-HTMLTableStyle -BackgroundColor Yellow -Type RowHover New-HTMLTableStyle -BackgroundColor Yellow -Type RowHoverSelected

Hopefully this will help everyone who uses this functionality.

linefeed1 avatar Jan 24 '23 18:01 linefeed1

Why don't you create PR, modifying the source https://github.com/EvotecIT/PSWriteHTML/blob/master/Public/New-HTMLTableStyle.ps1 so we can add it to the original release?

PrzemyslawKlys avatar Jan 24 '23 20:01 PrzemyslawKlys

RowHoverSelect

I've tried to see what you mean but I can't confirm your issue. Can you please explain or show what it is about?

PrzemyslawKlys avatar Apr 20 '23 07:04 PrzemyslawKlys

This appears to effect selected rows (highlighted in blue) only in hover mode.

In the demo you appear to only select one row at time and choose hover on an odd row (#7) but if you try to select multiple rows or a block with a click and holding down shift select several rows above then you'll have a block of selected rows to test/hover against. It's interesting as you happen to choose row 7 in the demo above which is odd and is designed verification route and it works for you.

Sorry for the miscommunication and hopefully this clarifies the issue.

linefeed1 avatar Apr 20 '23 11:04 linefeed1

demo

linefeed1 avatar Apr 20 '23 20:04 linefeed1

Weird

I guess I've even weirder behavior. This is in Edge ;)

$ProcessesAll = Get-Process | Select-Object -First 10 -Property Name, Id, StartTime

New-HTML -TitleText 'Title' -Online -FilePath $PSScriptRoot\Example-SearchBuilder.html -ShowHTML {
    New-HTMLTableStyle -BackgroundColor Blue -Type RowSelected
    New-HTMLTableStyle -BackgroundColor Yellow -Type RowHover
    New-HTMLTableStyle -BackgroundColor Yellow -Type RowHoverSelected

    New-HTMLSection -HeaderText 'Search Builder 1' {
        New-HTMLTable -DataTable $ProcessesAll -SearchBuilder -Buttons excelHtml5, copyHtml5, csvHtml5 {

        }
    }
    New-HTMLSection -HeaderText 'Search Builder as button' {
        New-HTMLTable -DataTable $ProcessesAll
    }
    # This won't really work - button + searchBuilder
    New-HTMLSection -HeaderText 'Search Builder + button' {
        # Search Builder will be disabled, button will work
        New-HTMLTable -DataTable $ProcessesAll -SearchBuilder
    }
}

PrzemyslawKlys avatar Apr 20 '23 20:04 PrzemyslawKlys

Perhaps the code base has changed as the baseline mentioned was a change to PSWriteHTML.psm1 v.0.0.180 from the package here: https://www.powershellgallery.com/packages/PSWriteHTML/0.0.180

linefeed1 avatar May 05 '23 20:05 linefeed1

I also have this problem, but only when you add New-HTMLTableStyle -Type Table

for example: $Processes = Get-Process | Select-Object -First 5 -Property *

New-HTML -TitleText 'Title' -Online -ShowHTML { New-HTMLTableStyle -Type RowSelected -TextColor '#ffffff' -BackgroundColor '#25006D' New-HTMLTableStyle -Type RowHover -TextColor '#ffffff' -BackgroundColor '#25006D' New-HTMLTableStyle -Type RowHoverSelected -TextColor '#ffffff' -BackgroundColor '#25006D' New-HTMLTableStyle -Type Table -TextColor '#000000' -BackgroundColor '#ffffff' New-HTMLSection -HeaderText 'Search Builder as button' { New-HTMLTable -DataTable $Processes } }

You'll see that it fails to highlight the even rows, but if you comment out the New-HTMLTableStyle -Type Table -TextColor '#000000' -BackgroundColor '#ffffff' line it'll work.

This is the same in Firefox and Edge.

kieranwalsh avatar Apr 30 '24 10:04 kieranwalsh