Help, please. Multiple pages of repeaters, pagination bar, and Show-more-Show-less (accordion) function bug.

Hi guys, I have a question, hope anyone can help me, kind of lost here….

I have a repeater that I’ve connected to a dataset. Since the DB should include around 75 items, I use a pagination bar, and everything is sweet. I added “show-more / show-less” button to hide and reveal a few text elements [I will refer those elements as ‘additional-text’] in the repeater (accordion.) On load it works fine, the (first) page is loading the additional-text collapsed, with “show more” button (for every item in the page) as it should be.

Now, here is the problem – when I use the pagination bar to load the next few items (next page), instead of hiding the additional-text, the site shows it, and also, the button is “show more” (when the text is shown it should be “show less.”)

I’ve added an onClick event to the bar, and now it loads the new items without the additional text, yet after a sec (when the page is fully loaded) the additional text revealed.

Now, here is more information that may help to solve this mystery:
when use the pagination bar to revisit a page (e.g., from 1/10 to 2/10 and back to 1/10) the additional text on this page (e.g., 1/10) is hidden, and the button is “show more” as it should be.

I’ve tried to use “next page” and “previews page” actions on buttons instead of the pagination bar, and the additional text is always shown on every page but the first one.

I guess that I should add this code to a reload function or something like that, but I have no idea how to do that, to be honest, I’m not even sure it possible at the moment.

        $w("#paperAbstract").text = shortText; //text element
        $w("#citePaper").collapse(); //text element
        $w("#showMoreLess").label = "Show more"; //this is the button

Thank you in advance,
d.

Are you trying to mash together the code for the show more/show less toggle or the show more button as shown here. https://support.wix.com/en/article/corvid-tutorial-creating-a-show-more-link

With the previous and next page buttons as shown on this tutorial here.
https://support.wix.com/en/article/corvid-tutorial-creating-previous-and-next-buttons-for-a-dynamic-item-page-with-code

Hi, thank you for the response.
Nope, I used the show more/show less code from tutorial link.
But since I don’t use dynamic pages, I’ve added a simple pagination bar. Besides, the 2nd tutorial is for “item pages”, I don’t have those in the site. It’s just a small personal website that displays list of academic papers with links. I added the show more/show less for abstracts and citation format. And everything is work fine, the only bug is that when I use the pagination bar it shows the abstracts. Now I’ve notice that it does hide the citation.

So what are you using?

  $w("#paperAbstract").text = shortText; //text element
        $w("#citePaper").collapse(); //text element
        $w("#showMoreLess").label = "Show more"; //this is the button

Show More Button

// display the full text
$w("#myTextElement").text = fullText;
// collapse the button
$w("#myButton").collapse(); 

Show More/Show Less Toggle

// check the contents of the text element
if ($w("#myTextElement").text === shortText) {
// if currently displaying short text, display the full text
$w("#myTextElement").text = fullText;
$w("#myButton").label = "Show less";
} else {
// if currently displaying full text, display the short text
$w("#myTextElement").text = shortText;
$w("#myButton").label = "Show more"; 

You can’t do a mixture of both after your export function and the click event handler.