Move values in a column to the right

Move values in a column to the right

olvaolva Posts: 17Questions: 7Answers: 0

Hello!
There is such a problem - in some columns the values need to be moved to the right side of the cell. These are table codes:
hrml

 <table id="price" class="cell-border" style="width:100%">
                                <thead>
                                <tr>
                                    <th>ART</th>
                                    <th>NAME</th>
                                    <th>PRICE WHOLESALE</th>
                                    <th>PRICE RETAIL</th>
                                    <th>QUANT</th>
                                    <th>ID</th>
                                    </tr>
                                </thead>
                            </table>

js

 $(document).ready(function () {
        var table = $('#price').DataTable({
            "autoWidth": false,
            "language": {
                "url": "//cdn.datatables.net/plug-ins/1.10.20/i18n/Russian.json"
            },
            "order": [[0, "asc"]],
            'ajax': 'layouts/ajax/price',
            "columns": [
                {"data": "art"},
                {"data": "prod_name"},
                {"data": "price_wholesale"},
                {"data": "price_retail"},
                {"data": "quant"},
                {"data": "id", "visible": false, "searchable": false},
            ],
       
        });
}

this option is not workable

$('td').css{float:right};

How to solve this problem most gracefully and correctly. Again, this is necessary for some columns. I will be very grateful for any hint.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    This example should help - it's setting the final column to be right-aligned,

    Colin

  • olvaolva Posts: 17Questions: 7Answers: 0

    Thank you for such prompt help!

This discussion has been closed.