aoColumnDefs, sClass and aTargets (using class name) doesn't work.
aoColumnDefs, sClass and aTargets (using class name) doesn't work.
kmd1970
Posts: 36Questions: 8Answers: 1
I am trying to use "aoColumnDefs" with "sClass" and "aTargets" (using the class name) and it doesn't seem to work.
When I debugged the jQuery.DataTables.js code I found that line 433 was always returning "false" for .hasClass().
[code]
432 if ( aTargets[j] == "_all" ||
433 $(oSettings.aoColumns[k].nTh).hasClass( aTargets[j] ) )
[/code]
Here is my Datatables live example:
http://live.datatables.net/bepesey/1/edit
Test Code Sample:
[code]
$(document).ready( function () {
var table = $('#example').DataTable(
{
"aoColumns": [
{"sTitle":"myTitle" ,"sClass": "myClass" },
null,
null,
null,
null,
null
],
"aoColumnDefs": [
{
"mRender": function ( data, type, row ) {
return ''+data+'';
},"aTargets": ['myClass']
}
]
}
);
} );
[/code]
When I debugged the jQuery.DataTables.js code I found that line 433 was always returning "false" for .hasClass().
[code]
432 if ( aTargets[j] == "_all" ||
433 $(oSettings.aoColumns[k].nTh).hasClass( aTargets[j] ) )
[/code]
Here is my Datatables live example:
http://live.datatables.net/bepesey/1/edit
Test Code Sample:
[code]
$(document).ready( function () {
var table = $('#example').DataTable(
{
"aoColumns": [
{"sTitle":"myTitle" ,"sClass": "myClass" },
null,
null,
null,
null,
null
],
"aoColumnDefs": [
{
"mRender": function ( data, type, row ) {
return ''+data+'';
},"aTargets": ['myClass']
}
]
}
);
} );
[/code]
This discussion has been closed.