Changing font color of cell span

Changing font color of cell span

olvaolva Posts: 17Questions: 7Answers: 0

there is a span in the cell. what is the best way to change its state (color) depending on the conditions

 "columns": [
                {"data": "prod_name", "width": "25%"},
                {"data": "prod_artikul", "width": "5%"},
                {"data": "prod_artikul_original"},
                {"data": "prod_barcode"},
                {"data": "prod_quantity"},
                {"data": "prod_unite"},
                {"data": "prod_price"},
                {"data": "id", "visible": false, "searchable": false},
                {"data": "updated_at", "visible": false, "searchable": false},
                {
                    "data": null,
                    "targets": -1,
                    "defaultContent": "<a href=\"#myModalBox\" data-toggle=\"modal\" role=\"button\" class=\" delete\" >" +
                        "<span style=\"font-size: 1em; color: Tomato;\" title=\"Del\"><i class=\"fas fa-trash-alt  fa-fm\"></i></span></a>&nbsp; &nbsp;<a href=\"#\"  role=\"button\" class=\" copy\" >" +
                        "<span style=\"font-size: 1em; color: #398e3c;\" title=\"Copy\"><i class=\"fas fa-copy  fa-fm\"></i></span></a>&nbsp;&nbsp;<a href=\"#\" role=\"button\" class=\" edit\" >" +
                        "<span style=\"font-size: 1em; color: #0e148e;\" title=\"Edit\"><i class=\"fas fa-edit  fa-fm\"></i></span></a>&nbsp;&nbsp;<a href=\"#\" role=\"button\" class=\" show1\" >" +
                        "<span style=\"font-size: 1em; color: rgba(205,26,174,0.81);\" title=\"View\"><i class=\"fas fa-eye  fa-fm\"></i></span></a>",
                },
                {
                    "data": null,
                    "targets": -1,
                    "defaultContent": " <span class=\"hover\" style='color: tomato;visibility: visible' ><i class=\"fas fa-exclamation-triangle \" ></i></span>"
                }
            ],

Variant no work

rowCallback: function (row, data) {
                var today = new Date();//сегодня
                var updated = Date.parse(table.row(row).data().updated_at);               {{--}}дата обновления продукта{{--}}
                days = (today - updated) / (1000 * 60 * 60 * 24);
                if (data.prod_quantity <= 2 || days >=60) {
                    $(row).css({backgroundColor: "#F9DEE0"});
                    $('td', row).children().eq(10).css({color: "blue" });//I understand that the problem is here, but unfortunately I do not understand what the error is
                }

I will be grateful for any help and idea!!!

Answers

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    Please see the reply in your other thread.

    Colin

This discussion has been closed.