After Reinitialize header and body not aligned

After Reinitialize header and body not aligned

anasuryanaanasuryana Posts: 3Questions: 1Answers: 0
edited February 21 in Free community support

i try upgrade from version 1.13.8 to 2.0.0

after inspecting element there are two colgroup element when after i reinitialize the datatable.

currently i manually remove first colgroup element before i reinitialize datatable.

the code to remove is like this

tblUserInfo.getElementsByTagName('colgroup')[0].remove()

is this the only one way to keep header and body aligned ?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Colin

  • vovarpdvovarpd Posts: 2Questions: 0Answers: 0

    I had a similar issue related to the misalignment header & body columns.
    I resolved it by removing destroy: true from the table init. Also changed the instance retrieval code.
    .
    https://datatables.net/manual/tech-notes/3#Object-instance-retrieval

  • allanallan Posts: 63,441Questions: 1Answers: 10,459 Site admin

    @vovarpd If you could link to a test case showing the issue, hopefully I'll be able to fix it rather than needing workarounds. At the moment, I've not seen this bug, so I don't know what is causing it and have zero change of actually fixing it. A test case would really help.

    Allan

  • anasuryanaanasuryana Posts: 3Questions: 1Answers: 0

    this is first time i use jsbin and share code. please try

    https://jsbin.com/tehicow/1/edit?html,js,output

  • allanallan Posts: 63,441Questions: 1Answers: 10,459 Site admin

    Got it - thank you! I've committed a fix and it will be in the 2.0.1 drop.

    Allan

  • anasuryanaanasuryana Posts: 3Questions: 1Answers: 0

    thank you allan :)

Sign In or Register to comment.