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.

How to set initial sorting and pagination state?

See original GitHub issue

Hi,

is there a way to manipulate the sorting icons state or pagination state when initially loading the table?

I have implemented react-bootstrap-table2 with remote pagination and sorting. As described in the documentation I pass options like page to the paginationFactory and sortField etc. for sorting. Everything works fine so far when navigating through the data using the onTableChange event.

As the data like sorting and pagination is saved in a store, I am using this parameters every time the user comes back to the same table rather than resetting the table to the original state. This means the user can set table sizes, sorting etc. to their preferences and will find everything they configured whenever coming back to the table.

This works fine in terms of data display as everything is passed correctly to my API and populated to the data table.

But here’s the catch: visually the react-bootstrap-table2 does not match the displayed data anymore. So let’s say I ordered by customer name and am on pagination page 3. When coming back to the page the data is loaded correctly, but the customer name column icons appear as if they are not sorted, the pagination shows page 1 instead of 3 and also the information about “Showing rows 1 to 5 of 255” is not correct anymore.

So long story short: is there a way to manipulate the icons or the pagination state to match the data displayed when populating the data the first time to the table?

I did not find a suitable solution in the documentation until now, but maybe someone has a solution approach.

Thanks in advance.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mathiaswillburgercommented, Jul 27, 2018

Sure, I’ll prepare a complete example asap.

1reaction
waynebrantleycommented, Jul 27, 2018

Would need more info. Setting the page will have the grid display the correct page, we use it. Give a more complete example (including paginationOptions)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table pagination and sorting - OutSystems 11 Documentation
Pagination and sorting are the features you get automatically if you create a table by dragging an Entity to the Screen.
Read more >
Front End Tables: Sorting, Filtering, and Pagination
I'll start getting the pagination set up. Pagination.js ... We need to hold two pieces of data in state for sorting:.
Read more >
How to set a default sorting to a jh-table? - Stack Overflow
I have a jh-table with a working header that sorts by each field, but I would like to have it sorted by a...
Read more >
Default ordering (sorting) - DataTables example
With DataTables you can alter the ordering characteristics of the table at initialisation time. Using the order initialisation parameter, you can set the ......
Read more >
Set a Default Sort Option - Jetboost Knowledge Base
Quick note: We recommend using a select field input for the sort element (which is the first setup we'll talk about). You can...
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