best practice for live initiation
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?
Well, a.ajax is absolutely default behavior of the library. Just call $.nette.init() and that should be it. It should work.
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?
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.
OK, thanks