Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters: Add type="search" to text filters #8113

Closed
melloware opened this issue Nov 25, 2021 · 4 comments · Fixed by #8118
Closed

Filters: Add type="search" to text filters #8113

melloware opened this issue Nov 25, 2021 · 4 comments · Fixed by #8118
Assignees
Labels
new feature workaround A workaround has been provided
Milestone

Comments

@melloware
Copy link
Member

melloware commented Nov 25, 2021

Description
As requested on the forums: https://forum.primefaces.org/viewtopic.php?f=3&t=69745

Adding type="search" to filters to allow modern browers to add the "x" to clear filter icons.

PrimeVue issue: primefaces/primevue#83

Describe the solution you would like
Simply adding type="search" to the generated input boxes for filter inputs

WORKAROUND

You can add this 1 line of Jquery code to your page to make all the filters have this...

$('input.ui-column-filter.ui-inputfield.ui-inputtext').attr('type', 'search');
@melloware melloware added new feature workaround A workaround has been provided labels Nov 25, 2021
@melloware melloware self-assigned this Nov 26, 2021
@melloware melloware linked a pull request Nov 26, 2021 that will close this issue
@melloware
Copy link
Member Author

Very happy with this new feature. Not sure if you want to mark it for 12.0 or not @tandraschko but is pretty clever and useful!

@tandraschko
Copy link
Member

lets decide @mertsincan

@melloware
Copy link
Member Author

From @mertsincan

Hi,
I think we can add showClearButton or showClear attribute to Column. So we can easily style it by themes.

showClear* : When enabled, a clear icon is displayed to clear the value.

https://www.primefaces.org/showcase/ui/input/inputText.xhtml?jfwid=d6123 (Right icon demo)

WDYT?

@melloware
Copy link
Member Author

This can all be styled with CSS so we can easily theme it if we need to.

input[type="search"] {
  border: 1px solid gray;
  padding: .2em .4em;
  border-radius: .2em;
}

input[type="search"].dark {
  background: #222;
  color: #fff;
}

input[type="search"].light {
  background: #fff;
  color: #222;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 1em;
  width: 1em;
  border-radius: 50em;
  background: url(https://pro.fontawesome.com/releases/v5.10.0/svgs/solid/times-circle.svg) no-repeat 50% 50%;
  background-size: contain;
  opacity: 0;
  pointer-events: none;
}

input[type="search"]:focus::-webkit-search-cancel-button {
  opacity: .3;
  pointer-events: all;
}

input[type="search"].dark::-webkit-search-cancel-button {
  filter: invert(1);
}

@melloware melloware added this to the 14.0.0 milestone Sep 10, 2023
melloware added a commit to melloware/primefaces that referenced this issue Nov 29, 2023
melloware added a commit to melloware/primefaces that referenced this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature workaround A workaround has been provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants