columns.width is incorrect

columns.width is incorrect

hitman333hitman333 Posts: 6Questions: 1Answers: 0

Hi. Please help. When I write like this:

$table.DataTable({
    columns: [
        {data: 'selected', width: "20px"},
        {data: "qwe1"},
        {data: "qwe2"},
        {data: "qwe3"},
        {data: 'qwe4'},
        {data: 'qwe5'},
        {data: "qwe6"},
        {data: 'qwe7'},
        {data: 'qwe8'},
        {data: 'qwe9'}
    ]

My 1 column must be 20px. But on the site I have 20.91px. (Look at attach)
How can I change this and set 20px?

Answers

  • hitman333hitman333 Posts: 6Questions: 1Answers: 0
    edited May 2018

    And what is the interesting. When I add >= 220px to the another column, then my 1 column is correctly 20px and another 220px. But if it is <220px then the bug is here.

    $table.DataTable({
        columns: [
            {data: 'selected', width: "20px"},
            {data: "qwe1"},
            {data: "qwe2"},
            {data: "qwe3"},
            {data: 'qwe4'},
            {data: 'qwe5'},
            {data: "qwe6"},
            {data: 'qwe7'},
            {data: 'qwe8'},
            {data: 'qwe9'}
        ]
    

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Do you have any padding defined on the header cell perhaps? If you can link to a page showing the issue that would be useful.

    Allan

  • hitman333hitman333 Posts: 6Questions: 1Answers: 0

    What is the page you mean? With my project? It is not possible to show you my project.

  • hitman333hitman333 Posts: 6Questions: 1Answers: 0

    And I have not any padding.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Can you recreate the issue on http://live.datatables.net , JSFiddle, CodePen or something else so I can take a look please?

    Allan

  • hitman333hitman333 Posts: 6Questions: 1Answers: 0

    It is a little difficult because I have a lot of code and it is angular.
    But I find some interesting. It is because
    $table.DataTable({
    scrollY: true
    })

    When scrollY: false the size of my columns is ok. But if we have scroll we have this bug. Maybe now you know what we can do?))

  • hitman333hitman333 Posts: 6Questions: 1Answers: 0
This discussion has been closed.