Is there any way to change options after initializing dataTable?
Is there any way to change options after initializing dataTable?
mickypc
Posts: 4Questions: 1Answers: 0
i want to change the ajax options after initializing a dataTable,my version is 1.10.7
any idea is appreciated.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
A bit more information here is very much welcome. What options would you like to change? Do you wish to reload the datatable? Do you simply want to re
draw
the datatable?Are you trying to perform a search? Do you use controls outside of the datatable that you want to initiate the reload?
Too many questions, please provide us with more insight.
Hope this helps,
Thanks a lot. sorry for my vague question.
i am going to perform a search in the server-side schema.i just want to change my ajax.data params to include my search keyword and then reload the dataTable.
Before:
"ajax": {
"url": "man_stucr_act.jsp",
"data": {
"act": 1
},
"dataSrc": "stucrs"
}
After:
"ajax": {
"url": "man_stucr_act.jsp",
"data": {
"act": 1,
"keyword": "search something"
},
"dataSrc": "stucrs"
}
Generally no, there is no way to change the options after initialisation. However, in the case of
ajax.data
- just use it as a function. The function will be evaluated at the point every Ajax request is made, so you can easily modify the parameter based on whatever criterion you need at that point in time.Allan
Thanks. a pretty nice solution!!!