Filters does not work with lazy loading - datatable

UI Components for React
Post Reply
sajjanhubale
Posts: 10
Joined: 05 Nov 2018, 04:59

18 Mar 2019, 12:17

Hi Team,

I am not able to filter the data with lazy loading in datatable.

can you please help how can we do this?

Appreciate your response!

Regards,
Sajjan Hubale

sajjanhubale
Posts: 10
Joined: 05 Nov 2018, 04:59

22 Mar 2019, 05:34

can you please help to solve the problem of filter issue?

sajjanhubale
Posts: 10
Joined: 05 Nov 2018, 04:59

13 Apr 2019, 11:23

Hi Team,

It would be grate if you can implement this feature.

Regards,
Sajjan

janishaik
Posts: 1
Joined: 02 Aug 2019, 00:48

02 Aug 2019, 04:57

Even we also facing same issue, let us know if we have any solution for this issue.

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

10 Sep 2019, 12:40

Hi all,

You need to implement it by yourself using onFilter method.Exp;

Code: Select all

onFilter(event) {
        //event.filters -> Collection of active filters.
        
        this.setState({
            loading: true
        });

        //imitate delay of a backend call
        setTimeout(() => {    
            this.setState({
                first: 0,
                cars: // the returned value from backend,
                totalRecords: // the returned value's length
                loading: false,
                filters: event.filters
            });
        }, 1000);
    }

Code: Select all

<DataTable value={this.state.cars} paginator={true} rows={this.state.rows} totalRecords={this.state.totalRecords}
                        lazy={true} first={this.state.first} onPage={this.onPage} loading={this.state.loading} filters={this.state.filters} onFilter={this.onFilter}>
                        <Column field="vin" header="Vin" filter={true}/>
                        <Column field="year" header="Year" />
                        <Column field="brand" header="Brand" />
                        <Column field="color" header="Color" />
                    </DataTable>
Best Regards,

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests