Asynchonously fetching data for dropdown when searching

UI Components for React
Post Reply
einsamer1203
Posts: 1
Joined: 12 Jul 2019, 04:22

12 Jul 2019, 04:26

I would like to perform a fetching list of options to dropdown when user typing in search-box, do we have a way to work like that?
I checked the properties in the document, but can't find the way.
Could you guys please help me on it?
Thank you!

ieugen
Posts: 2
Joined: 07 Apr 2019, 23:18

17 Jul 2019, 11:54

Hello,

We also bought primereact and we need this feature.
We use apollo client in our app and we would like to have the ability to query the server using the filter data so we can update the results.

To my knowledge there is no way of doing that and we have to look for alternatives.

Please reply.

Regards,
Eugen

ieugen
Posts: 2
Joined: 07 Apr 2019, 23:18

17 Jul 2019, 12:17

Hello,

First of all - we are a paying customer and so far we had a nice experience with primereact.
There are some missing features and this is one of the important ones.

We have the same need here. We need to display remote data in a DropDown and we need to be able to send the query + filter to the server for results.
There is no way of doing this with DropDown since there is no way of getting the event for then the filter has changed.
For us, it would be nice the get a single filter chanage event with the full filter value instead of getting inividual keystrokes.

Also, we have pagination for the API (relay style) on those lists and it would be nice to support this use case as well -> have the ability to add a paginator component that could render some pagination controls and events to update the query for the new pages.

Please help us: we need the hooks to implement the functionality.

Regards,
Eugen

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

11 Sep 2019, 09:55

Hi,

Sorry for the late reply! For now, it doesn't support this feature. Could you please create a github ticket for this feature? https://github.com/primefaces/primereact/issues

Maybe, we can add lazy property and onFilter callback for it.
Exp;

Code: Select all

onFilter() {
        //imitate delay of a backend call
        setTimeout(() => {
    
            this.setState({
                cars: // the filtered options sent from backend
            });
        }, 250);
    }
    
    <Dropdown options={this.state.cars} lazy={true} onFilter={this.onFilter} />
Best Regards,

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests