imballinst / react-bs-datatable

Bootstrap datatable without jQuery. Features include: filter, sort, pagination, checkbox, and control customization.
https://imballinst.github.io/react-bs-datatable
MIT License
60 stars 20 forks source link

Cannot re-render? #2

Closed ans-4175 closed 7 years ago

ans-4175 commented 7 years ago

Looking through https://imballinst.github.io/react-bs-datatable/ I put search text and changed number show options per page. But it won't rendered, any misconfig on your gh-pages ?

imballinst commented 7 years ago

Hi there!

I'm sorry I couldn't reproduce your problem with Chrome 55.0.2 and Firefox 50.1. I think, if the table doesn't render any row, your search text doesn't find any matching column in the given dataset. Could you give the steps to reproduce it and if possible, the screenshot as well, so I can analyze it further? Thanks

ans-4175 commented 7 years ago

Changed to third page screenshot from 2017-01-25 08 39 40

Then search brandy, nothing result. screenshot from 2017-01-25 08 40 20

Looks like searching only works in first page?

imballinst commented 7 years ago

You're right, there's a pagination problem when filtering on the pages other than the first one. My guess is that when the user filters the data, the "current pagination before filter" persists.

  1. User A switches to page 3 (page state on the table set to 3)
  2. User A enters a text to the input field
  3. This causes the entire dataset to be filtered based on A's input. Therefore, the table that once has N pages will now have less than N pages
  4. If N <= 3, the component is still working. However, if N < 3, it will cause rendering problem because the component's state tells the render method to render the 3rd page, which is undefined after the filter.

Thanks for your report, I will address this issue soon.

imballinst commented 7 years ago

@ans-4175 Hi, I just pushed a commit that should fix this issue. Please check the Github Page of this repo to see whether this issue has been resolved or not

ans-4175 commented 7 years ago

Still has a bug. If I put text to search, then only produced one result. I still can click next page button, so it will show empty results. Shouldn't be disabled the pagination button?

imballinst commented 7 years ago

My bad, missed a logic on empty-dataset pagination. How is it now?

ans-4175 commented 7 years ago

Good, works perfectly :)