mRender return object doesnt work ! why ?

mRender return object doesnt work ! why ?

babablacksheepbabablacksheep Posts: 41Questions: 23Answers: 0
edited April 2014 in DataTables 1.9
I am trying to return an object in mRender function but datatable adds [object Object] string in column.
is it possible to return object ? because it can be helpful in structured coding to grab ref to object and use it later.

Works
[code]
{

'bSortable': false,
'aTargets': [0],
'mRender': function (data, type, row) {
return '';
}
}
[/code]

Doesn't work . why ?
Benefit of returning object is that I can keep its refer in structured coding so i don't have to use jquery selectors to find it again.
[code]
{

'bSortable': false,
'aTargets': [0],
'mRender': function (data, type, row) {
return $("").attr({
name: "selectedbx[]",
value: data,
type: "checkbox"
}).addClass('newcheckboxes');
}
}
[/code]

Replies

  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin
    mRender has to return a string, integer or other display data. It cannot return a node or jQuery object containing a node because the parent row might not exist when mRender is called! If you want to manipulate the element, use fnCreatedCell .

    Allan
This discussion has been closed.