Combine to functions in javascript
Combine to functions in javascript
Karlheinz
Posts: 2Questions: 1Answers: 0
Hi everyone,
I try to combine to functions in javascript to work with datatables, but it doesn't work. How can I combine both functions in Javascript so that they both work?
$(document).ready(function() {
$('#cx_data').DataTable( {
order: [[ 2, 'desc' ], [ 0, 'asc' ]],
"ordering": false,
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json",
}
} );
} );
and
$(document).ready(function() {
$('#cx_data').DataTable( {
"createdRow": function ( row, data, index ) {
if ( data[5].replace(/[\$,]/g, '') * 1 > 150000 ) {
$('td', row).eq(5).addClass('highlight');
}
}
} );
} );
Every hint is appreciated. I've already spent hours trying to figure it out, but without success.
Thank you
Karlheinz
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
When you say they don[t work what does that mean? Please describe specifically what happens.
Do you get any error messages (alert or browser console)?
I suspect you are getting a syntax error because you are missing a comma that is needed to separate the parameters, ie, between
createdRow
and the other parameters. Something like this:Kevin
That was it. A simple comma.
Thank you very much, Kevin!