Switch from fnRender to mRender

Switch from fnRender to mRender

lcurtinlcurtin Posts: 6Questions: 0Answers: 0
edited March 2013 in DataTables 1.9
I have always used fnRender to combine columns.

[code]
"aoColumnDefs": [
{ // merge address1 and 2 into this column
"fnRender": function ( oObj ) {
return oObj.aData[2] +'
'+ oObj.aData[3];
},
"aTargets": [ 2 ]
},
{ // hide address2 column
"bVisible": false,
"aTargets": [3]
{
]
[/code]

I am at a loss doing this with mData and mRender.

[code]
mRender: function ( data, type, row ) {
var formatted = ""
formatted = (data + '
' + data[2])
return formatted;}
},
[/code]

Returns "Alexandra e". The field and the third character of the field.

Help, please. What simple thing am I not doing?

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    `row` is the data for the row. You want to use:

    [code]
    return data +'
    '+ row[3];
    [/code]

    Allan
  • lcurtinlcurtin Posts: 6Questions: 0Answers: 0
    Thanks. I knew I was missing something "obvious."
This discussion has been closed.