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
Filters does not work with lazy loading - datatable
-
- Posts: 10
- Joined: 05 Nov 2018, 04:59
can you please help to solve the problem of filter issue?
-
- Posts: 10
- Joined: 05 Nov 2018, 04:59
Hi Team,
It would be grate if you can implement this feature.
Regards,
Sajjan
It would be grate if you can implement this feature.
Regards,
Sajjan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi all,
You need to implement it by yourself using onFilter method.Exp;
Best Regards,
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>
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests