Hi,
I'm currently having an issue resetting a dataset to only display the default "Number of Items to Display" after changing tabs and coming back.
The example in question can be found here: https://www.tobymcdowell.com/portfolio
Scrolling down on the All tab and clicking "See More" adds 9 items to the list using the loadMore() function.
Going on to different tabs does not refresh the amount of items visible from 18 (since "See More" was pressed) to 9 (the default amount of records displayed).
Returning to the "All" tab shows 18 items in the list, where I would prefer it be the default value
Is there a way to achieve this?
Here is my button code:
// Changes tab based on parameters, disables button pressed
export function SelectCategory($w, _prevSelection, filter, category)
{
$w(prvSelection).enable();
prvSelection = _prevSelection;
$w(_prevSelection).disable();
$w("#btnSeeMore").hide();
// Display preloader
ShowLoadingGif($w);
// Change filter
$w("#dataset1").setFilter(wixData.filter()
.contains(filter, category)
);
// Refresh and remove the preloader after completion
$w("#dataset1").refresh().then ( () => {
// Reset 'See More' button
SetSeeMoreButtonDisplay($w);
HideLoadingGif($w);
});
}
I have searched the WixCode API and as far as I can tell no property exists to change or read the "Number of Items to Display" property of the data set.
I have also tried clearing the repeater that is attached to the Dataset but that doesn't work either.
Any help would be greatly appreciated!
The only other thread I can find about this issue is https://www.wix.com/corvid/forum/community-discussion/repeater-links-buttons-load-amount-collapse-and-expand-1 and its also unresolved. Would also really appreciate a direction to go in!
Hi,
Please re-post this question in a new thread with more details and explanations and what you were struggling with.
Thanks,
Tal.
I have this exact same problem. There are 600 names on my web page and a search that uses the dataset filter, so being able to reset the number of items shown on a dataset is necessary, otherwise the search is slowed down tremendously. I tried using $w("#dynamicDataset").setPageSize(5); but $w("#dynamicDataset").loadMore() seems to override that. Any advice would be great!
No worries, could you please update this post when you support this functionality?
Hey Toby,
We're still working on completing the API for working with datasets and repeaters. Hopefully that will be out soon. In the meantime, you can probably achieve what you're trying to do if you forgo the dataset and populate the repeater using code.