question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirecting to first page after changing table properties when you on last page

See original GitHub issue

Hi,

  1. I created some gridTable based on ReactBootstrapTable;
  2. I have ReactBootstrapTable with pagination and row selection;
  3. 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:
  4. My data rows count is 29, SizePerPage is set to 10. I’ll have 3 pages;
  5. I’ll go to the last page and clicked to some row.
  6. onRowSelect event is fired and i put some data to the state of my gridTable. (onRowSelect it means: selectRow.onSelect event);
  7. 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:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
odzhurkocommented, Sep 20, 2016

@AllenFang, thank You for reply and for help. New version doesn’t have that issue

0reactions
AllenFangcommented, Sep 20, 2016

@odzhurko, upgrade react-bootstrap-table to higher version will solve this issue. Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found