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
794 stars 105 forks source link

Filter on reload #14

Open kort3x opened 5 years ago

kort3x commented 5 years ago

On page reload, tables still get filtered but the search field is shown as empty.

Example:

Table filtered for "Acrobat" image

After reloading the page, the filter is still applied but the search field is empty image

Placing the cursor in the search field and hitting "backspace" clears the invisible filter

PrzemyslawKlys commented 5 years ago

Thanks for reporting. It seems to be a bug in DataTables. I'll investigate whether this can be addressed with some JS to clear this, if not I'll try to open bug report in DataTables.

PrzemyslawKlys commented 5 years ago

Hrmms, how are you using it?

Import-Module PSWriteHTML.psd1 -Force
Import-Module PSSharedGoods -Force

if ($null -eq $Process) {
    $Process = Get-Process | Select-Object -First 70
}

New-HTML -TitleText 'My title' -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath $PSScriptRoot\Example19.html -Verbose {
    New-HTMLContent -HeaderText 'Test1' {
        New-HTMLTable -DataTable $Process -PagingOptions @(50, 100, 150, 200) -Filtering -FilteringLocation Top {
            New-HTMLTableCondition -Name 'HandleCount' -Type number -Operator gt -Value 300 -BackgroundColor Yellow
            New-HTMLTableCondition -Name 'ID' -Type number -Operator gt -Value 16000 -BackgroundColor Green
            New-HTMLTableCondition -Name 'Name' -Type string -Operator eq -Value 'browser_broker' -BackgroundColor Gold -Row
        }
    }
} -ShowHTML

Can't reproduce it? I type anything in filters, press F5 and it simply reloads. Also which browser? I tested in Google Chrome.

PrzemyslawKlys commented 5 years ago

Ok, I see in Edge Chromium and Firefox this is what you describe. I'm using Chrome 75 and no such thing happens. Will try to find out why.

kort3x commented 5 years ago

I'm using chrome 73

kort3x commented 5 years ago

I have HTMLTabs in there, maybe that's the issue?

kort3x commented 5 years ago

Here is a gist. I am to stupid to format PS code in the comments

https://gist.github.com/kort3x/3fb8f260cfc6f7f2bacb43b65b3a38ec

PrzemyslawKlys commented 5 years ago

Nah, you can format code in comment by using 3x ``` at the begining and 3x at the end. https://help.github.com/en/articles/creating-and-highlighting-code-blocks

kort3x commented 5 years ago

3x you mean ;)

PrzemyslawKlys commented 5 years ago

Yes!

kort3x commented 5 years ago

New-HTML -TitleText 'Software' -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath C:\inetpub\wwwroot\reports\software\softwareoverview\softwareoverview.html {
  New-HTMLTab -TabName 'Licensed Software'  {
      New-HTMLContent {
          New-HTMLTable -DataTable ($licensedSoftware | Select-Object Name,Version,Publisher,Computername,InstallDate,Collected) -PagingOptions @(100, 200) -Filtering -FilteringLocation Top
      }
  }
  New-HTMLTab -TabName 'Freeware'  {
      New-HTMLContent {
          New-HTMLTable -DataTable ($freeSoftware  | Select-Object Name,Version,Publisher,Computername,InstallDate,Collected) -PagingOptions @(100, 200) -Filtering -FilteringLocation Top
      }
  }
}
kort3x commented 5 years ago

ah, that's better

PrzemyslawKlys commented 5 years ago

It seems I've fixed this error - at least I think so. Will be in next release. Feel free to reopen when needed.

kort3x commented 5 years ago

looking good - thanks!

tomerikko commented 3 years ago

Hi, i see a very similar thing, (using 0.0.132 ver) When i use the '''New-HTMLTable''' '''-Filtering''' option, if you use any of those "per column" filters, upon page reload it will still be filtered until you touch that filter field ,do space and delete or similar.

Since this one seems to be marked as closed, shall i start a new thread for this?

image