Keyword

K2 - AJAX Pagination - load more items

More
5 years 2 months ago #171018 by JoomlaWorks
Replied by JoomlaWorks on topic K2 - AJAX Pagination - load more items
That is correct, given you only show the "leading" items block.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171049 by Dimitris
Replied by Dimitris on topic K2 - AJAX Pagination - load more items
ok I got it to work!
I think my mistake was that I had placed the "load more" button outside the k2 wrapper.
I still had to replace $ with jQuery because I was getting an TypeError: $ is undefined - the same happened with beez3 template

Thank you

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171061 by JoomlaWorks
Replied by JoomlaWorks on topic K2 - AJAX Pagination - load more items
You're welcome.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago - 5 years 1 month ago #171075 by Dimitris
Replied by Dimitris on topic K2 - AJAX Pagination - load more items
Even though it works I've noticed something, that it might not cause any issues in the default templates, it does though cause issues with mine.


The structure is:
#itemListLeading
  .itemContainer
  .itemContainer
  .itemContainer

The way I understand append, the extra items should be loaded under the last itemContainer

Instead the script creates this:
#itemListLeading
  .itemContainer
  .itemContainer
  .itemContainer
  #itemListLeading
    .itemContainer
    .itemContainer
    .itemContainer

why is it duplicating the content div? Having two divs with the same id is not exactly correct either.

obviously I don't have a clue what I'm talking about, but it might have to do with this line?
var items = $(data).find('#' + newsContainer);
Last edit: 5 years 1 month ago by Dimitris.

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171089 by Dimitris
Replied by Dimitris on topic K2 - AJAX Pagination - load more items
well I did manage to get the results I wanted by changing
var items = $(data).find('#' + newsContainer);

to
var items = $(data).find(".itemContainer");

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171113 by JoomlaWorks
Replied by JoomlaWorks on topic K2 - AJAX Pagination - load more items
The example originally provided is a bit messy. I'll create a more modern equivalent using the default layouts and paste it back here in the coming days.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171381 by bonzomedia
Replied by bonzomedia on topic K2 - AJAX Pagination - load more items
This was what I was looking for. However, this method obviously does not trigger K2's onK2AfterDisplayContent which is what my plug-in needs in order to trigger. Any way to trigger this client side in the JS?

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #171384 by JoomlaWorks
Replied by JoomlaWorks on topic K2 - AJAX Pagination - load more items
The plugin event is inside category_item.php which means it is triggered as the items are already in the container. If it's not triggered, perhaps you have disabled K2 plugin parsing in the category settings (or even specific K2 items). And of course make sure the plugin event is present in category_item.php. Compare with the source template files when in doubt.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago #174761 by Jonathan
Replied by Jonathan on topic K2 - AJAX Pagination - load more items
This does work, however as Dimitris pointed in default the containers under itemListLeading conflict with the template i am using, it works but once i load more items the styling gets slightly messed up. I tried Dimitiris suggestion by using:
var items = $(data).find(".itemContainer");

But then it does not load the clr divs.

There was mention of updating the code but i think it hasn't been posted.

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago #174780 by JoomlaWorks
Replied by JoomlaWorks on topic K2 - AJAX Pagination - load more items
Just show one of the blocks, e.g. "leading". This will simplify the appending process.

Of course it's possible to do it differently by creating an outside container which will have it's contents appended to itself upon scrolling.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum