order.dt fired after ajax call
order.dt fired after ajax call
Hi @colin ,
I am using server side settings to init DataTable and I got an issue about order.dt event fire after ajax request.
I would like to custom orderField and orderType and they can be change, update dynamic from query url, last state, sorting by click on the icon up, down in table header,.....So that, I create in input hidden field to keep it, all changes need to be update it into input hidden field, and when Data Table init, It will take this options from input hidden field.
Example here: http://live.datatables.net/tefavivi/1/edit
As you can see, the order.dt event just fired once table draw, the order.dt info was log after ajax request done\
Do you know if we have an event to update the ajax.data (for orderField, orderType) when its updated before ajax called?
Replies
Hi @n2lose ,
I don't quite follow what you're asking for - but you can change or add to the data being send by Ajax with
ajax.data
, there's a few examples on that page.Hope that does the trick,
Cheers,
Colin
Hi @colin ,
Thank you for helping me.
As you can see log in my example, the ajax.data option run before order.dt even.
Please see the code in the comment:
It works fine but that mean I can not change order settings by the way:
So, I just want to know if there is any other ways to update?
Thanks,
Lam
Hi @n2lose ,
I'm really sorry, but I'm not following - maybe the coffee just hasn't kicked in yet. With that example you sent, could you say exactly what you want, with steps to reproduce.
Cheers,
Colin
Hi @colin ,
Actually, I just want to know if we have an order event that fired before ajax request?
In my example, when we click on the table header to reorder data, I am using the event order.dt, but it fired after ajax request to draw table.
I'm not sure I follow what you are wanting to do but you might be able to use the
preXhr
event to process the server side request before its sent to the server.Kevin