Using Same mData Multiple Times with fnRender

Using Same mData Multiple Times with fnRender

yahyaerturanyahyaerturan Posts: 4Questions: 0Answers: 0
edited March 2013 in DataTables 1.9
Version: DataTables 1.9.4

I want to use same "oObj.aData.id_company" in multiple columns but it can't render it. It's all OK if I use it only one time as in second code block below:

[code]
var col_def = [
{ "mData": "id_company", "sTitle":"Edit","fnRender" : function (oObj){
return 'Edit';
}
},
{ "mData": "company_name", "sTitle":"Company Name", "sWidth":"50%"},
{ "mData": "id_company", "sTitle":"Delete","fnRender" : function (oObj){
return 'Delete';
}
}
];
[/code]

[code]
var col_def = [
{ "mData": "company_name", "sTitle":"Company Name", "sWidth":"50%"},
{ "mData": "id_company", "sTitle":"Delete","fnRender" : function (oObj){
return 'Delete';
}
}
];
[/code]

I am doing wrong or missing something?

Here is the code for debug: http://debug.datatables.net/unocid

Replies

  • yahyaerturanyahyaerturan Posts: 4Questions: 0Answers: 0
    Any comment?
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Yes - fnRender is dead - don't use it :-). It will be removed in 1.10 (it already has been in git). Use mRender instead which doesn't have this problem (this is one of the reasons fnRender has been removed).

    Allan
  • yahyaerturanyahyaerturan Posts: 4Questions: 0Answers: 0
    Thank you, very well noted. Also
    [code]
    "mRender":function(data,type,row) {
    return ...
    }
    [/code]
    is simply rocks with using [code] "mData" : null [/code]. Thanks for great plugin.
This discussion has been closed.