Input's width resizes - How to modify?

Input's width resizes - How to modify?

PeacepipePeacepipe Posts: 9Questions: 4Answers: 0

Hello,

I've a table for which I'm using DataTable.

This table has input fields inside each row. This is the current view of the table without DataTable:

However, when DataTable is added:

@section scripts{

    <script>
            $(document).ready(function () {
                $("#contadores").DataTable({
                    stateSave: true
                });
            });
    </script>
}

The table resizes becoming wider:

I would like to know how to resize this columns. I've tried with this: https://datatables.net/reference/option/columns.width

@section scripts{

    <script>
            $(document).ready(function () {
                $("#contadores").DataTable({
                    stateSave: true,
                    "columnDefs": [
                        { "width": "20%", "targets": 4 }
                    ]
                });
            });
    </script>
}

But there are no changes.

Thanks!

Answers

  • jvretamerojvretamero Posts: 26Questions: 0Answers: 3

    Try declaring the table with the width attribute as 100%, for example:

    <table width="100%"></table>
    

    This "trick" is useful to me.

This discussion has been closed.