-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
WIth this Yii2 component, https://bitbucket.org/ereminmdev/yii2-infinite-scroll/src/master/, I got the re-initialization still failed.
Can you provide a comment of the following code ?
For now, the comment is redirect to something like: http://localhost/comment/default/create?entity=x---
$JS = <<<JS
jQuery.ias().on("rendered", function(elements) {
let pjaxContainer;
let pjaxContainerId;
let form;
let formId;
jQuery.each(elements, function(key, element){
pjaxContainer = jQuery(element).find('div').closest('.comment-wrapper');
pjaxContainerId = '#' + pjaxContainer.children().first().attr('id');
form = jQuery(element).find('div').closest('form');
formId = '#' + form.attr('id');
jQuery.pjax.reload({
container: pjaxContainerId,
timeout: 1000000,
scrollTo: false,
url: window.location.href
}).done(function() {
jQuery(formId).comment('init', {
pjaxContainerId: pjaxContainerId
});
});
});
});
jQuery(document).on('pjax:complete', function(event) {
console.log(event.target);
});
JS;
$this->registerJs($JS);
Metadata
Metadata
Assignees
Labels
No labels