-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ajaxComplete and ajaxDone customization #132
base: master
Are you sure you want to change the base?
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 [email protected]
|
Cool! Here is the link: https://www.clahub.com/agreements/alfajango/jquery-dynatable |
@@ -114,6 +114,23 @@ | |||
sortTypes: {}, | |||
records: null | |||
}, | |||
ajax: { | |||
ajaxComplete: function(response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :)