Sorry was just testing, narrowed it down to it being an issue on paginated links. If you switch to a different page and select a link it does not load through Pjax, just as a regular page load. I'm guessing that it's something to do with those links not being in the DOM when loaded.
Sorry was just testing, narrowed it down to it being an issue on paginated links. If you switch to a different page and select a link it does not load through Pjax, just as a regular page load. I'm guessing that it's something to do with those links not being in the DOM when loaded.
I'm guessing that it's something to do with those links not being in the DOM when loaded.
It sounds like the elements are being dynamically generated. Try calling pjax.parseDOM(document) after switching pages.
>I'm guessing that it's something to do with those links not being in the DOM when loaded.
It sounds like the elements are being dynamically generated. Try calling `pjax.parseDOM(document)` after switching pages.
That seems to have partly solved the issue however when clicking on the pagination links Pjax is trying to load the root page because the buttons have a href value of # i got around this before by using javascript:void(0) in the href value but would then need to override the datatable functionality to do get around this. Is there any way to tell Pjax to ignore href with # value?
That seems to have partly solved the issue however when clicking on the pagination links Pjax is trying to load the root page because the buttons have a href value of # i got around this before by using javascript:void(0) in the href value but would then need to override the datatable functionality to do get around this. Is there any way to tell Pjax to ignore href with # value?
Just come here to add that there is actually a pjax.refresh() method that is designed for situations like this where you need to make Pjax aware of new DOM elements which we should document properly. It is just a wrapper around pjax.parseDOM(), so @BehindTheMath's advice is still correct.
Just come here to add that there is actually a `pjax.refresh()` method that is designed for situations like this where you need to make Pjax aware of new DOM elements which we should document properly. It is just a wrapper around `pjax.parseDOM()`, so @BehindTheMath's advice is still correct.
https://github.com/MoOx/pjax/blob/216686696712d4a3cfe1ebe9b43c3fb5c8e2dd30/index.js#L69-L71
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
There seems to be an issue with Pjax not detecting links within DataTables. Any ideas how to get around this?
Please link to a CodePen demonstrating the issue.
https://codepen.io/xenace/project/editor/ZgPgEK#0
What's not working? Everything looks fine to me, and the links work on all pages.
Sorry was just testing, narrowed it down to it being an issue on paginated links. If you switch to a different page and select a link it does not load through Pjax, just as a regular page load. I'm guessing that it's something to do with those links not being in the DOM when loaded.
It sounds like the elements are being dynamically generated. Try calling
pjax.parseDOM(document)after switching pages.That seems to have partly solved the issue however when clicking on the pagination links Pjax is trying to load the root page because the buttons have a href value of # i got around this before by using javascript:void(0) in the href value but would then need to override the datatable functionality to do get around this. Is there any way to tell Pjax to ignore href with # value?
Ignore last message, resolved it by setting elements to a:not(.page-link)
Just come here to add that there is actually a
pjax.refresh()method that is designed for situations like this where you need to make Pjax aware of new DOM elements which we should document properly. It is just a wrapper aroundpjax.parseDOM(), so @BehindTheMath's advice is still correct.https://github.com/MoOx/pjax/blob/216686696712d4a3cfe1ebe9b43c3fb5c8e2dd30/index.js#L69-L71
That's true. I forgot about that method.