fnRender return DOM or jQuery objects possible?

fnRender return DOM or jQuery objects possible?

sd_zuosd_zuo Posts: 78Questions: 1Answers: 0
edited September 2011 in General
Is it possible to return jQuery or DOM objects from the fnRender functional property?
Returning string values is vulnerable to HTML code attack. If DOM objects are accepted, it can be safer.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    afaik, no. but I recall Allan posting something about a month ago where he hinted that it's possible to get DOM/jQuery objects during fnRender.. ? you might need to scour the forum for that.
  • sd_zuosd_zuo Posts: 78Questions: 1Answers: 0
    Thank you for the reply.
    I remember that I've read something similar before here. I think that it is reasonable and it maybe even bring better performance by returning DOM/jQuery objects from fnRender rather than HTML codes.
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    This is the thread the fbas refers to: http://www.datatables.net/forums/discussion/4975/fnrender-friendly-suggestion-to-return-also-jquery-objects/p1#Item_10 . The basic answer is, no this is not currently possible, and it would likely require a good be of reorganising in the DataTables core to make it possible. If you need to manipulate the DOM then fnRowCallback is the way to go at the moment.

    Allan
This discussion has been closed.