3
Let’s get to the problem. In datatable.js, to display the columns I define as follows:
"aoColumns": [
{ "mDataProp": "IdProcesso", "sTitle": "Numero" }
]
If you need to perform some function:
{
"mDataProp": "DataAbertura", "sTitle": "Data Abertura",
"fnRender": function (oObj) {
return //minha function vem aqui!
}
},
Now comes the question is it possible to add this Function in the Json object dynamically? When I say dynamic I mean the fact that this object will be created by another Function and at the end it returns me a string generated by JSON.stringify and Function is rendered unusable. I hope I’ve been able to explain my doubt
In a json not but an object yes, whether the datatable uses it or not is another question :) This object will be serialized in json or is to be consumed by the datatable API?
– Sergio
The application already receives a json I wanted to add the function. Then way will be to create the object and add the necessary function. Okay, thanks so much for the help.
– Deividson Oliveira
This object will be serialized in json or is to be consumed by the datatable API?
– Sergio
Consumed by the API.
– Deividson Oliveira
@Deividsonoliveira, I don’t know if it’s still relevant... but you can pass your Function as a string and when creating the object actually build it using the Function() class. However, this is far from good practice...
– Leandro Angelo