combine numberformat with render function

combine numberformat with render function

martin1223345martin1223345 Posts: 84Questions: 23Answers: 0

Hi all,

I am trying to color my number based on the color code stored in my colomn and render the number output in number format. Seperate this works fine. How do i combine the two? This is what i tried, but only the color aplies not the formating. What am i doing wrong?

 data: 'my_data',
 render: $.fn.dataTable.render.number( '.', '.', 0 ) && function ( data, type, row, meta ) {
                return '<font color='+row.cat_color+'>'+data+'</font>';
                } },

http://live.datatables.net/cekepoho/1/edit

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,332Questions: 26Answers: 4,774
    Answer ✓

    See if this thread helps. Something like this:

    render: function ( data, type, row, meta ) {
                   return '<font color='+row.cat_color+'>'+ $.fn.dataTable.render.number( '.', '.', 0 ).display(data) + '</font>';
                   } },
    

    Kevin

  • martin1223345martin1223345 Posts: 84Questions: 23Answers: 0

    That workes like a charm! Thank you verry much for your effords and support ( also on my other questions) I am new with this so i realy appreciate the help!

This discussion has been closed.