column width not auto adjusting

column width not auto adjusting

PabloArigonPabloArigon Posts: 4Questions: 0Answers: 0

Hi everyone, I'm having a problem with my data table when it's resized! i have a left div and when i hover over it, it expands, resizing the table and other elements, the datatable width resizes when the div opens, but when it closes, it doesn't resize and it looks like this in the image, already I tried table.columns.adjust() and it doesn't work! Any idea?

obs: I've looked in several forums including this one and nothing works for that

Code Image:

Error Image:

Link to test case: dont have
Debugger code (debug.datatables.net): i dont receive any debugger error
Error messages shown: without errors
Description of problem: problem with columns width

Replies

  • 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.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    edited June 2022

    Take a look at this example. The example states to set the width on the -tag table` tag, not with CSS like you have in line 2. If it doesn't help then we will need to see the problem. Please post the test caseColin asked for.

    Kevin

  • PabloArigonPabloArigon Posts: 4Questions: 0Answers: 0
    edited June 2022

    Hi kevin, as you can see, I configure the width in the html too, I tried both ways I saw on forums, but both don't work, it's still the same, i will going to do the test case

    Look:

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited June 2022

    Use the "table" tag only, NOT the "thead", and only use style="width:100%".

  • PabloArigonPabloArigon Posts: 4Questions: 0Answers: 0
  • PabloArigonPabloArigon Posts: 4Questions: 0Answers: 0

    Hey tangerine, I changed the table code, did as I said, removed thead and tbody and changed it, however, now I get errors when I start the datatable, the problem with table autoadjust apparently is fixed, but the datatable can't initialize

    Errors:

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    edited June 2022

    You test case has this error:

    Uncaught TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')

    The problem is you have 7 columns in the thead but only 6 in the row. I added a 7th column and the alignment. Something seems off. Removing display: inline-block; from the .itable CSS seems to fix it.
    http://live.datatables.net/wukatuno/1/edit

    If you still need help then update the test case to show the issue or provide the steps needed to see the problem.

    Kevin

Sign In or Register to comment.