AllenFang / AllenFang/react-bootstrap-table
Remote mutliple filter issue
- Lenguaje dominante
- JavaScript
- Estrellas
- 2.2k
- Forks
- 761
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Hi Allen,
Currently i'm doing server side pagination. To do this i'm using remote function. So far was so good. Unfortunately i have problem with remote filter. I tried to this according to your example in website.
In one way its works good. First i get data from database and the i use filter function. This part works as suppose to:

My code is:
if (Object.keys(filterObj).length === 0 ) {
this.props.getWorkersCountAndUpdate();
this.props.fetchWorkers()
return;
}
for(const key in filterObj) {
const data = this.props.workers.filter((worker) => {
let valid = true;
if (worker[key.toString()].indexOf(filterObj[key]['value']) === -1) {
return false;
}
return true;
});
this.props.updateWorkers(data);
}
As you can see in the result of my filtering there is only one record. Now when i erase one of filters nothing changes, i know it's because i update Workers and filter takes that updated workers data and try to find something in it. So my question is, what can i do to make it works like on your website?
One more thing, when i try to move for loop inside filter (like in your example), then loop only iterate on first instance of object... :

Code:

I really don't know how can i solve this.
Example which i mentioned: http://allenfang.github.io/react-bootstrap-table/example.html#remote -> remote filtering
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.