mRender from JSON server-side

mRender from JSON server-side

ITARulezITARulez Posts: 10Questions: 0Answers: 0
edited February 2013 in General
Hello,
i need to know if it's possible create mRender with function javascript inside a JSON object server-side. I need because i initialize DataTable from json server-side and not in client-side

Thx All

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    No its not - at least not with only DataTables. You need to make the Ajax call to the server to get the column definitions before initialising DataTables. Columns cannot currently be dynamically added and deleted from a DataTables. A shortcoming that I will be working on soon.

    Allan
  • ITARulezITARulez Posts: 10Questions: 0Answers: 0
    thx allan,

    for example

    JSON object from server-side:

    [code]
    {"aoColumns":[{"mData":"aaa","sName":"aaa","bSortable":true,"bVisible":true,"mRender":function(){ JAVASCRIPT LOGIC}}]}
    [/code]

    this is my goal...i need to do this in my server-side but don't work
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    That's not valid JSON. You've got a function in there. That is why this is not possible with DataTables directly - aoColumns is not always valid JSON. As soon as you use a function it isn't.

    You need to load the script dynamically, which is done outside of DataTables.

    Allan
This discussion has been closed.