Feature Request: Allow render to return an HTML element.
Feature Request: Allow render to return an HTML element.
danbopes
Posts: 1Questions: 1Answers: 0
Right now, when defining columns, you need to return a string, which is added to the column. It would be nice if you could return HTML elements as well, so that you can add your own custom functionalities. For example:
Right now, you'd have to do:
'columns': [
{
'data': 'title',
'render': function(val, _, obj) {
return '<a href="http://youtu.be/' + obj.videoId + '" target="_blank">' + val + '</a>';
}
},
What would be nice, is to do something like:
'columns': [
{
'data': 'title',
'render': function(val, _, obj) {
//Here I can attach custom handlers, and things that you can't normally do with setting inner/outerHTML.
return $('<a/>').text(val).attr('href', 'http://youtu.be/' + obj.videoId);
}
},
This discussion has been closed.
Answers
Thanks for the request. This is something that has come up a number of times before and is something I am aware of and thinking about how to introduce into future versions.
Regards,
Allan