ajaxComplete and ajaxDone customization#132
ajaxComplete and ajaxDone customization#132jasonl99 wants to merge 2 commits intoalfajango:masterfrom
Conversation
Moved the ajaxComplete and ajaxDone functions into the record object. This allows for customization (which allows you to do jquery promises/deferred, etc). To override, create a handler to respond to the dynatable:preinit message and swap in your ajaxSuccess and ajaxDone functions.
$('.dynatable').on('dynatable:preinit', function(el, dyna) {
dyna.settings.ajax.ajaxSuccess = yourSuccessFunction;
return dyna.settings.ajax.ajaxDone = yourDoneFunction;
})
|
+1 |
|
At top of the queue |
|
Hi @jasonl99! I'm helping @JangoSteve with Dynatable. We're getting ready to move forward with a lot of overdue work. We're having a meeting about all open PRs next week. We do require that all contributors sign the CLA. Are you available to do so? |
|
Sure -- but I ended up not using dynatable (though I still love it as a Jason On Fri, Oct 23, 2015 at 3:08 PM, Max Langensiepen notifications@github.com
|
|
Cool! Here is the link: https://www.clahub.com/agreements/alfajango/jquery-dynatable |
There was a problem hiding this comment.
I'd just call these settings success and complete instead of ajaxComplete and ajaxDone just to keep naming consistent and reduce redundancy (since they're located in the ajax object, setting ajax.success and ajax.complete is a bit cleaner than ajax.ajaxComplete, etc.
|
This looks great. Very clean code. Just had a couple small suggestions if you'd like to update the pull request, or we can do those as well. |
I needed to have more flexibility with ajaxComplete and ajaxDone. The changes I've made allow you to swap in your own ajaxComplete and ajaxDone functions. In my case, I'm using jquery.when() to require additional data, and then further updating the data returned by the dynatable ajax requested.
Just create a handler for the dynatable:preinit function to swap in your functions.
$('.dynatable').on('dynatable:preinit', function(el, dyna) {
dyna.settings.ajax.ajaxSuccess = yourSuccessFunction;
return dyna.settings.ajax.ajaxDone = yourDoneFunction;
})
Be gentle, javascript is definitely not my strong suit :)