primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.69k stars 1.01k forks source link

MultiSelect: Missing reset property #6700

Open juliecki opened 4 months ago

juliecki commented 4 months ago

Describe the bug

The documentation describes a reset filter function which cannot be accessed:

DOC:

image

CODE:

image

Reproducer

https://stackblitz.com/edit/vitejs-vite-3ekfuv?file=src%2FApp.tsx

PrimeReact version

10.6.3

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome

Steps to reproduce the behavior

No response

Expected behavior

reset should be available like filter

melloware commented 4 months ago

That reset is used in filterTemplate: https://primereact.org/multiselect/#api.MultiSelect.props.filterTemplate

/**
     * The template of filter element.
     */
    filterTemplate?: React.ReactNode | ((options: MultiSelectTemplateOptions) => React.ReactNode);

/**
 * Custom filter template options.
 */
interface MultiSelectTemplateOptions {
    /**
     * Style class of the filter.
     */
    className: string;
    /**
     * The filter element.
     */
    element: HTMLDivElement;
    /**
     * Style class of the filter icon.
     */
    filterIconClassName: string;
    /**
     * The filter input options.
     */
    filterOptions?: MultiSelectFilterOptions;
    /**
     * The props of multiselect header.
     */
    props?: any;
}

Can you explain what you need reset to do?

juliecki commented 3 months ago

reset should provide a button to reset the selected items. Currently you have to select all and unselect all to reset the selection. This is not a nice UX... Other than that feels the provided "close" button like this missing "reset" button.