How to embed fnRender function in json

How to embed fnRender function in json

dhicksondhickson Posts: 2Questions: 0Answers: 0
edited February 2011 in General
I would like to initialise a datatable by passing a json object as follows: $('#mytab').dataTable(json);
My json is held as a string in a database, and I parse it into json before calling dataTable(json)
I would like the json to be able to contain an fnRender function as follows:
{ "fnRender": function ( oObj ) { return oObj.aData[2] +'' ''+ oObj.aData[3]+'' ''+ oObj.aData[4];},"aTargets": [ 2 ]}
Trouble is, if I try putting that in the json string, then the json parser fails with invalid json because of the function definition.
So, how can I use my "db string" to "json object" technique and pass it to the dataTable function when the json string itself contains a function?
Thanks very much.
This discussion has been closed.