Redirecting to first page after changing table properties when you on last page
See original GitHub issueHi,
- I created some gridTable based on ReactBootstrapTable;
- I have ReactBootstrapTable with pagination and row selection;
- My gridTable remember some parameters in state, that parameters are bounded to ReactBootstrapTable as properties. (for example: selectRow.selected = this.state.selectedRow);
Now, imagine some scenario: - My data rows count is 29, SizePerPage is set to 10. I’ll have 3 pages;
- I’ll go to the last page and clicked to some row.
- onRowSelect event is fired and i put some data to the state of my gridTable. (onRowSelect it means: selectRow.onSelect event);
- After that i’m redirected to the first page of ReactBootstrapTable. Changing state in my gridTable causes rerendering ReactBootstrapTable and throwing new properties to ReactBootstrapTable.
After some researching i found that problem is in BootstrapTable.js row number = 576. After changing some properties in reactBootstrapTable the “componentWillReceiveProps” event is fired, and in that event implementation there is some condition:
// #125
if (!options.page && page >= Math.ceil(nextProps.data.length / sizePerPage)) {
page = 1;
}
That condition causes redirecting to first page. Let us look to the second part of that condition, in my case there will be (3 >= Math.ceil(29 / 10)) === (3 >= 3) === (true). As we can see the condition is fulfilled and i am redirected to the first page.!options.page
is fulfilled also.
I think that there must be page > Math.ceil(...
instead of page >= Math.ceil(...
.
What are your thoughts? Cause i see that it is the solution for #125 issue, but do we realy need >=
condition to solve that issue?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Click on a table row data should redirect to a html page using ...
If i click on a row, i need to redirect the page to another html page.How to perform this by using jquery. Note:I...
Read more >How to redirect to a particular section of a page using HTML or ...
Method 1: Using HTML: One can use the anchor tag to redirect to a particular section on the same page. You need to...
Read more >Word: Table or table row goes to next page
Table setting for 'Allow row to break across pages': Select the table row, right-click and select Table properties. Go to the Row tab,...
Read more >How To Redirect WordPress Users After Login - Kinsta
Here, we'll show you how to make sure WordPress redirect after login occurs precisely as you specify, step-by-step.
Read more >(Optional) Configuring a webpage redirect
Configure your bucket as a website by setting up redirect locations where ... To create redirection rules in the new Amazon S3 console,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AllenFang, thank You for reply and for help. New version doesn’t have that issue
@odzhurko, upgrade
react-bootstrap-table
to higher version will solve this issue. Thanks