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

best practice for live initiation #105

Open
Ciki opened this issue Sep 27, 2014 · 4 comments
Open

best practice for live initiation #105

Ciki opened this issue Sep 27, 2014 · 4 comments
Milestone

Comments

@Ciki
Copy link
Contributor

Ciki commented Sep 27, 2014

what is the best practice to automatically init all a.ajax links even those dynamically loaded?

should I write custom init function, sth like

$.nette.ext('init', {
    load: function (rh) {
        $('body').off('click.nette', this.linkSelector, rh).on('click.nette', this.linkSelector, rh);
// ...
}
}

or manually call $.nette.load() or sth else?

@vojtech-dobes
Copy link
Owner

Well, a.ajax is absolutely default behavior of the library. Just call $.nette.init() and that should be it. It should work.

@Ciki
Copy link
Contributor Author

Ciki commented Sep 27, 2014

but what about when I create new links e.g. using jquery & inject them to DOM. SHould they be automatically ajaxified or is this my responsibility?

@vojtech-dobes
Copy link
Owner

I see... then calling $.nette.load() is now the right way :). But I see the disadvantage... there should be more streamlined way to make elements ajaxified. I will try to prepare solution soon.

@Ciki
Copy link
Contributor Author

Ciki commented Sep 28, 2014

OK, thanks

@vojtech-dobes vojtech-dobes added this to the 2.1 milestone Jan 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants