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.

Paginator: Cannot read property 'options' of undefined

See original GitHub issue

In my container that is using bootstrap-table2 I optionally set pagination:

const pagination =
    numPages > 1
        ? paginationFactory({
              page: options.page,
              //other values
          })
        : undefined;

However the script here somehow assumes pagination.

This will error in Cannot read property 'options' of undefined when previously there were 2 pages but deleting the only item on the second page causes no more than one page (so pagination props is undefined).

The following code will reproduce the error:

https://github.com/amsterdamharu/table-bug

Worked around this issue by always setting pagination but if there is only one page it’ll be hidden with css:

const pagination = paginationFactory({...})
...
<div className={classNames({ ['hide-pagination']: numPages === 1 })}>
  <BootstrapTable
     pagination={pagination}

css:

div.hide-pagination > div.row.react-bootstrap-table-pagination {
    display: none;
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
AllenFangcommented, Oct 14, 2018

@amsterdamharu Please upgrade to react-bootstrap-table-next@1.3.0 and react-bootstrap-table2-editor@1.2.0

RELEASE NOTE

0reactions
AllenFangcommented, Oct 21, 2018

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'page' of undefined when making a ...
I'm at a loss for figuring out why paginator is undefined. Any ideas? My personal repo can be found here: git clone https://github.com/Atticus29 ......
Read more >
ERROR TypeError: Cannot read properties of undefined ...
You're trying to read the property 'page' of 'this.paginator'. 'this.paginator' doesn't appear to be defined anywhere in your code, and as the ...
Read more >
Unexpected compilation error: Cannot read property 'type' of null
But while deploying my code i am getting LWC1001: Unexpected compilation error: Cannot read property 'type' of null.
Read more >
Vue warn - Cannot read property 'length' of undefined
Well, it seems that products.data is empty. You need to make sure products.data is filled here to perform .lenght . If you probably...
Read more >
ANGULAR 13 TypeError Cannot read property of undefined
In this tutorial, we will see a most common error faced by the Angular developers named as "TypeError Cannot read property of undefined...
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