Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jasonl99
Copy link

@jasonl99 jasonl99 commented Jun 7, 2014

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 :)

jasonl99 added 2 commits June 7, 2014 13:44
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;
})
@Oxicode
Copy link

Oxicode commented Jun 26, 2014

+1

@drouillard
Copy link
Contributor

At top of the queue

@mlangens
Copy link

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?

@jasonl99
Copy link
Author

Sure -- but I ended up not using dynatable (though I still love it as a
tool)....I haven't looked at my modifications for a long while. But I will
certainly sign whatever you need.

Jason

On Fri, Oct 23, 2015 at 3:08 PM, Max Langensiepen [email protected]
wrote:

Hi @jasonl99 https://github.com/jasonl99! I'm helping @JangoSteve
https://github.com/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?


Reply to this email directly or view it on GitHub
#132 (comment)
.

@mlangens
Copy link

Cool! Here is the link: https://www.clahub.com/agreements/alfajango/jquery-dynatable

@@ -114,6 +114,23 @@
sortTypes: {},
records: null
},
ajax: {
ajaxComplete: function(response) {
Copy link
Member

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.

@JangoSteve
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants