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 do pagination right?

See original GitHub issue

All the examples out there, rely on fixed JSON files, that don’t show how you can do pagination by using JS.

I’m working with DynamoDB, and when I query for the data, I’m adding the data to the table like so:

//
//  ->  Execute the command
//
obj.ddb.query(params, function(error, data) {

    //
    //  1.  Check if there was an internal error
    //
    if(error)
    {
        console.info(params);
        return console.error(error);
    }

    data.Items.forEach(function(item) {

        //
        //
        //
        $('#table').bootstrapTable('insertRow', {
            index: 1,
            row: item
        });

    });

});

This works fine, but there isn’t a clear explanation how to go about doing the pagination. My questions are:

  • How can I add the total amount of items with JS?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
UtechtDustincommented, Jun 18, 2019

As already explained its only possible to load the data in chunks with ajax.

So your only option is to load the whole data into the table and then use the pagination option to only display some rows per page. The next version (will be released soon) can handle a lot of data without ajax, the current version have some perfocmance issues with large datasets, so you can only try if that is a way for you or not.

0reactions
davidgatticommented, Jun 18, 2019

But how then I tell the table there is more data that the user can get? Aaaaaaa 🤪

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pagination – Examples And Good Practices
Good Practices Of Pagination Design # · Provide large clickable areas · Don't use underlines · Identify the current page · Space out...
Read more >
Pagination - Bootstrap
Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping <nav> element to...
Read more >
CSS Pagination Examples - W3Schools
Learn how to create a responsive pagination using CSS. Simple Pagination. If you have a website with lots of pages, you may wish...
Read more >
Bootstrap alignment of button and pagination - Stack Overflow
I am using Twitter Bootstrap 3 to build my new website. I want to place a button on the left side and a...
Read more >
A simple guide to Pagination in React | by Kunal Nalawade
So, you can implement pagination on the backend side itself and fetch the data one page at a time. Here too, you may...
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