AllenFang / AllenFang/react-bootstrap-table

Remote mutliple filter issue

オープン
#1,928 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
2.2k
フォーク
761
PR マージ指標
30日以内にマージされた PR はありません

説明

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:
![image](https://user-images.githubusercontent.com/7368798/37824646-95858b72-2e8d-11e8-97ad-374736612198.png)

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... :
![issue](https://user-images.githubusercontent.com/7368798/37827488-fe441732-2e97-11e8-8624-5145844ffccf.png)

Code:
![image](https://user-images.githubusercontent.com/7368798/37827519-1a00fc1a-2e98-11e8-907b-5454e6eeae28.png)

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。