Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky header attempts to render, while not initialized #7174

Open
vever001 opened this issue Feb 5, 2024 · 1 comment
Open

Sticky header attempts to render, while not initialized #7174

vever001 opened this issue Feb 5, 2024 · 1 comment
Labels
Bug Issues which are marked as Bug sticky-header Issues for the sticky-header extension.

Comments

@vever001
Copy link

vever001 commented Feb 5, 2024

Bootstraptable version(s) affected

1.22.2

Description

When combining the filter-control and sticky-header, we get an error in console.
See https://live.bootstrap-table.com/code/vever001/17062

Uncaught TypeError: Cannot read properties of undefined (reading 'offset')
    at p.value (bootstrap-table-sticky-header.min.js:10:20501)
    at p.value (bootstrap-table-sticky-header.min.js:10:19051)
    at bootstrap-table-filter-control.min.js:10:49522

It seems the onColumnSearch gets called from here, and calls this.renderStickyHeader() without checking if sticky headers is enabled on the table or not (while the sticky header may not have been initialized).

Example(s)

https://live.bootstrap-table.com/code/vever001/17062

Possible Solutions

Add a check for this.options.stickyHeader ?

Additional Context

FWIW we made a temp workaround as follows for now:

$.BootstrapTable = class extends $.BootstrapTable {
  renderStickyHeader () {
    if (this.options.stickyHeader) {
      super.renderStickyHeader();
    }
  }
}
@vever001 vever001 added the Bug Issues which are marked as Bug label Feb 5, 2024
@wenzhixin wenzhixin added the sticky-header Issues for the sticky-header extension. label Feb 11, 2024
@wenzhixin
Copy link
Owner

A PR is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug sticky-header Issues for the sticky-header extension.
Projects
None yet
Development

No branches or pull requests

2 participants