Is there a way to use AJAX data source with dynamically fetched columns?
Is there a way to use AJAX data source with dynamically fetched columns?

Hi, I've searched for many times but have not got an answer yet.
I'm trying to figure out if there is a way for me to use ajax option so that I can take advantage of ajax.reload() feature, and also dynamically load columns rather than using static arrays or object?
thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You will need to use an external jQuery.ajax() request to get the column definitions. Something like this example:
http://live.datatables.net/gesagewo/1/edit
In the example the URL to fetch the columns and for the
ajax
option are the same. They don't need to be the same. They are this way due to the URL's available at http://live.datatables.net.I don't believe there is a way to use the response in
ajax
to build the column definitions and pass that to thecolumns
option.Kevin