Skip to content

Commit

Permalink
Fixed #2846 - Add resetFilterOnHide property to Dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Aug 31, 2022
1 parent 400cabe commit a0f9d34
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api-generator/components/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ const DropdownProps = [
default: "pi pi-spinner pi-spin",
description: "Icon to display in loading state."
},
{
name: "resetFilterOnHide",
type: "boolean",
default: "false",
description: "Clears the filter value when hiding the dropdown."
},
{
name: "virtualScrollerOptions",
type: "object",
Expand Down
4 changes: 4 additions & 0 deletions src/components/dropdown/Dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ export interface DropdownProps {
* Default value is 'pi pi-spinner pi-spin'.
*/
loadingIcon?: string | undefined;
/**
* Clears the filter value when hiding the dropdown.
*/
resetFilterOnHide?: boolean;
/**
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
* @see VirtualScroller.VirtualScrollerProps
Expand Down
5 changes: 5 additions & 0 deletions src/components/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export default {
type: String,
default: 'pi pi-spinner pi-spin'
},
resetFilterOnHide: {
type: Boolean,
default: false
},
virtualScrollerOptions: {
type: Object,
default: null
Expand Down Expand Up @@ -272,6 +276,7 @@ export default {
this.focusedOptionIndex = -1;
this.searchValue = '';
this.resetFilterOnHide && (this.filterValue = null);
isFocus && this.$refs.focusInput && this.$refs.focusInput.focus();
}
Expand Down
6 changes: 6 additions & 0 deletions src/views/dropdown/DropdownDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ export default {
<td>pi pi-spinner pi-spin</td>
<td>Icon to display in loading state.</td>
</tr>
<tr>
<td>resetFilterOnHide</td>
<td>boolean</td>
<td>false</td>
<td>Clears the filter value when hiding the dropdown.</td>
</tr>
<tr>
<td>virtualScrollerOptions</td>
<td>object</td>
Expand Down

0 comments on commit a0f9d34

Please sign in to comment.