Change the left border of some cells : render function ?

Change the left border of some cells : render function ?

trucmuche2005trucmuche2005 Posts: 71Questions: 22Answers: 2

Hello,

I'm using DataTables with Bootstrap (Adminlte) and I would like to change the left border of cells which satisfies some conditions.

The content of the cell is rendered using "render:function ( data, type, row ){... return data['text']; }" but I would like to put a 5px green border on the left of the cell IF data['something'] is true.

How can I do that ?

Many thanks in advance,

T.

Answers

  • trucmuche2005trucmuche2005 Posts: 71Questions: 22Answers: 2

    Hmmm. I found a start of a solution using

    "createdRow": function( row, data, dataIndex ) {
                if (data['something']!=""){
                        $(row).addClass('myBorder');
                    }
              },
    

    and

    td.myBorder, tr.myBorder{
        border-left: 2px solid green !important;    
        color: green;
    }
    

    This works BUT the left border does not appear... Why ??
    I'm using those classes for my table : "table table-bordered table-striped table-hover"

    Many thanks for your help...

    T.

  • trucmuche2005trucmuche2005 Posts: 71Questions: 22Answers: 2

    Well, Ok I managed to do it using
    $('td:first-child', row).addClass('myBorder');
    Solved :-)

This discussion has been closed.