External Json file for columns' name.

External Json file for columns' name.

antonio77antonio77 Posts: 17Questions: 0Answers: 0
edited February 2010 in General
Hi,

For rows data is possible to define the data in External JSON file ("sAjaxSource": "external.json")
with "aaData" key.
Example:
[code]
"aaData" :[['row1-val1','row2-val2']…,['row2-val1','row2-val2']…,..]
[/code]
Is it possible to define an "columns' name list" in JSON ?
Which key I have to use?

thanks,

Antonio

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Antonio,

    There isn't a built in way to do this for the pain Ajax source. There are internal functions which you could use through the API to re-order columns, if you do so, I'm sure others in the forum would be interested to know how you get on. But a simpler way might be to use fnServerData to 'post-process' the JSON object returned from the server.

    This example is for server-side processing and adding GET data, but it shows the use of fnServerData, which works for plain Ajax source as well: http://datatables.net/examples/server_side/custom_vars.html . You can post-process the return with your custom object parameters in the callback function.

    Regards,
    Allan
This discussion has been closed.