I want to render a number on my data amount in column

I want to render a number on my data amount in column

tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0
edited January 2020 in Free community support

this is my code

{data:'amount',
            render: function(data, type,row){
              
              if(row.trans_type=='Penalty'){
                 return ''+row.credit+'';
              } else{
                 return ''+row.debit+'';
              }
              
            }, render : $.fn.dataTable.render.number(',','.',2)
             
            },

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    i dont have a amount column in database, but i have debit and credit column and in column header amount i want to show if the data is credit it will show the credit data and debit it will show debit data and the render function is not working because there are no parameter amount on database

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    This example is doing what you're after,

    Colin

This discussion has been closed.