Apply CSS class to built with mRender

Apply CSS class to built with mRender

liblib Posts: 9Questions: 1Answers: 0

Hi,

I'm using css classes '.center' and '.right' to display contents of cell in the center or in the right of table cells.

But now, after changing the contents of a column like this:

[code]
"aoColumnDefs": [
{ "mRender": function ( data, type, row ) {
return "<a target=_blank href=http://localhost:8000/ap/getdata.php?n=" + data + ">" + data + "</a>";
}, "aTargets": [ 1 ]
}
[/code]

I'd like to change the <a> css style of the cell of column 1. Tried this:

[code]
.dt1 a {
text-decoration: none;
background: green;
color: red;
}

.dt1 a:link {
color: rgb(0, 0, 153)
background: red;
}
[/code]

and this:
[code]
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0,2,16 ] },
{ "sType": "string", "sClass": "center", "aTargets": [ 3,4,5 ] }, //string, numeric, date and html
{ "sClass": "right", "aTargets": [ 6,7,8,9,10,11,12,13,14,15 ] },
{ "bSearchable": false, "aTargets": [ 0,4,5,6,7,8,9,10,11,12,13,14,15,16 ] },
{ "sClass": "dt1", "aTargets": [ 1 ] },
[/code]

(the missing part here is the above code showing mRender).

Problem is that I'm not able to change to style of column 1. What should I do to make it happen?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to a test case showing the problem so I can debug it please?

    Allan

  • liblib Posts: 9Questions: 1Answers: 0

    Hello Allan,

    I've already found out the origin of the problem. There were some errors in some advanced CSS attributes I used not supported in my firefox that were preventing further options to be loaded and applied.

This discussion has been closed.