Fixed #2846 - Add resetFilterOnHide property to Dropdown

pull/2929/head
mertsincan 2022-08-31 11:07:32 +01:00
parent 400cabe01f
commit a0f9d344a8
4 changed files with 21 additions and 0 deletions

View File

@ -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",

View File

@ -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

View File

@ -132,6 +132,10 @@ export default {
type: String,
default: 'pi pi-spinner pi-spin'
},
resetFilterOnHide: {
type: Boolean,
default: false
},
virtualScrollerOptions: {
type: Object,
default: null
@ -272,6 +276,7 @@ export default {
this.focusedOptionIndex = -1;
this.searchValue = '';
this.resetFilterOnHide && (this.filterValue = null);
isFocus && this.$refs.focusInput && this.$refs.focusInput.focus();
}

View File

@ -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>