Skip to content

CI4: Bootstrap-table header broken on scroll #3854

Closed

Description

@objecttothis

bootstrap-table handles creating the table header and body. The header is pinned during scroll, which is good, but on scroll it breaks causing the formerly non-visible header columns to appear and scrolling to no longer be fixed to the table.

image

You can see below that the header row is decoupled in horizontal scrolling from the table body. This does not happen when the header is not trying to pin itself.
image

Activity

  1. added this to the 3.4.0 milestone on Nov 18, 2023
  2. added
    CodeIgniter4
    on Dec 12, 2023
  3. objecttothis commented on Dec 12, 2023

    @objecttothis
    MemberAuthor

    I upgraded the version of bootstrap-table to 1.22.1, but the issue persists. I was able to duplicate the issue on the bootstrap-table demo page of their website, so this is an issue specific to the StickyHeaders functionality in bootstrap-table. I created an issue in their repo wenzhixin/bootstrap-table#7090

  4. jekkos commented on Dec 12, 2023

    @jekkos
    Member

    Thanks for looking into this @objecttothis ! I wonder if there would be a way to make the table more responsive.

  5. objecttothis commented on Dec 12, 2023

    @objecttothis
    MemberAuthor

    Thanks for looking into this @objecttothis ! I wonder if there would be a way to make the table more responsive.

    It's responsive for large and medium screens but not for small. It's possible that moving everything to bootstrap 5 will make it easier to make the entire table responsive. Likely the goal will be to specify how wide the table view is able to get down to and possibly to make the footer sticky on small displays. We may need to replace bootstrap-table if it can't do these things.

    I just checked this example on their site (https://examples.bootstrap-table.com/) and it's much more responsive with sticky footers, so it looks like we may be able to make it work... they are using Bootstrap 5 though.

  6. jekkos commented on Dec 20, 2023

    @jekkos
    Member

    I saw some activity in the bootstrap tables project for this one, will check if we can upgrade to the latest commit.

  7. 19 remaining items

  8. added a commit that references this issue on Oct 28, 2024
    28b8ff2
  9. objecttothis commented on Nov 4, 2024

    @objecttothis
    MemberAuthor

    The owner of the bootstrap-tables repo believes this issue is limited to bootstrap 3 which is EOL so it's a won't fix. I'm not convinced that it only affects bootstrap 3 because it's visible even on their demo site, which I don't think is using bootstrap 3. That said, if the issue is indeed not a problem with bootstrap 5, then the solution would be to migrate to bootstrap 5.

  10. objecttothis commented on Nov 4, 2024

    @objecttothis
    MemberAuthor

    The bootstrap-table dev suggests adding this code will fix the issue but I couldn't get it to work. Perhaps I was either adding it to the wrong place or the code is running minimized versions of the javascript and ignoring my changes.

    I added the code just above the table init code. I tried manage_tables.js, tabular.php and tabular_details.php but none had an effect on the issue. Maybe someone else can take a crack at it.

    const _resetView = BootstrapTable.prototype.resetView
    
    BootstrapTable.prototype.resetView = function (params) {
      _resetView.apply(this, [params])
      setTimeout(() => {
        // only bootstrap3
        this.$tableBody.trigger('scroll')
      }, 100)
    }
    

    wenzhixin/bootstrap-table#7578 (comment)

  11. jekkos commented on Nov 4, 2024

    @jekkos
    Member

    I believe @BudsieBuds had some bs5 prototype he wanted to show me, curious if that could get us kick started. For the js did you run the gulp install?

  12. objecttothis commented on Nov 4, 2024

    @objecttothis
    MemberAuthor

    I believe @BudsieBuds had some bs5 prototype he wanted to show me, curious if that could get us kick started. For the js did you run the gulp install?

    Yep,

    composer install
    npm install
    npm run build
    
  13. BudsieBuds commented on Nov 5, 2024

    @BudsieBuds
    Member

    I believe @BudsieBuds had some bs5 prototype he wanted to show me, curious if that could get us kick started. For the js did you run the gulp install?

    Yes, I'll make sure to get this to you.

  14. jekkos commented on Nov 28, 2024

    @jekkos
    Member

    A potential solution was posted in wenzhixin/bootstrap-table#7090 (comment). I tried it out but not sure if it fixes the issue

  15. jekkos commented on Nov 28, 2024

    @jekkos
    Member

    I removed both offsets and looks better now . Pushed this to master now. Hope this will suffice.
    image

  16. added a commit that references this issue on Nov 28, 2024
  17. objecttothis commented on Nov 29, 2024

    @objecttothis
    MemberAuthor

    Super I'd say let's push that and we can close this issue.

  18. jekkos commented on Nov 29, 2024

    @jekkos
    Member

    Should be fixed, will close

  19. odiea commented on Nov 29, 2024

    @odiea
    Collaborator

    Works great. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CodeIgniter4bugpending

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions