Running some jQuery after redrawing
Running some jQuery after redrawing
crazycoders
Posts: 6Questions: 0Answers: 0
Hi,
I've been messing up with serverside processing for a while today and now that i got it to work, there is something i need to know.
When the redraw completes, i'd like to run a snippet of jQuery:
[code] $('a.exchangelink').click(function(event){
event.preventDefault(); //stop default browser behaviour
alert("This alert will be displayed without following the link");
});
[/code]
To be able to intercept the links out of the grid and pass them through some AJAX call. But i can't seem to do this unless i put it throught a setTimeout of 1sec for example.
What would be the code to actually override the fnCallback and call the real one then override the links!
I've been messing up with serverside processing for a while today and now that i got it to work, there is something i need to know.
When the redraw completes, i'd like to run a snippet of jQuery:
[code] $('a.exchangelink').click(function(event){
event.preventDefault(); //stop default browser behaviour
alert("This alert will be displayed without following the link");
});
[/code]
To be able to intercept the links out of the grid and pass them through some AJAX call. But i can't seem to do this unless i put it throught a setTimeout of 1sec for example.
What would be the code to actually override the fnCallback and call the real one then override the links!
This discussion has been closed.
Replies
1. Use fnDrawCallback - http://datatables.net/usage/callbacks#fnDrawCallback
2. Use fnServerData and do the post processing after you've called the update function - http://datatables.net/examples/server_side/custom_vars.html . Is this what you are trying to do at the moment? There is no reason why, in the DataTables code, that this would be asynchronous. Perhaps jQuery doing something clever? If this doesn't work - fnDrawCallback will :-)
Allan