mData

mData

estudiosestudios Posts: 52Questions: 0Answers: 0
edited September 2013 in General
Can I use mathematical operators in mData. How??.
For example
"aoColumns": [
{ "mData": "date1"},
{ "mData": "date2"},
{ "mData": date2-date1}
],

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Use mRender as a function:

    [code]
    mData: 'date1',
    mRender: function (data, type, row) {
    return row.date2 - row.date1;
    }
    [/code]

    Allan
  • estudiosestudios Posts: 52Questions: 0Answers: 0
    Thanks a lot Allan

    Every single day I do like more and more datatables...it is really awesome.
    Just to feel good and help someone else... the complete syntax is
    "mRender": function (data, type, row) {
    return parseInt( (new Date(row.fieldname1) - new Date(row.fieldname2)) / (24*3600*1000)) ;}
This discussion has been closed.