How to make Load More button with code, to load more of the filtered data in the repeater

So we have a repeater that can be filtered with selection tags (information from the dataset). That works great. The issue I’m having is that it only loads 50 results in the repeater and when I click the “load more” it just resets the repeater without the filter.

I want the load more button to load more on the page while keeping the filter in mind.

Here is the code I have for the selection tag filters:

export function selectionTags1_change ( ) {
const selectedGenre = $w ( ‘#selectionTags1’ ). value ;
const selectedVoice = $w ( ‘#selectionTags2’ ). value ;
const selectedAvailable = $w ( ‘#selectionTags3’ ). value ;

loadDataToRepeater ( selectedGenre , selectedVoice , selectedAvailable );
}

export function selectionTags2_change ( ) {
const selectedGenre = $w ( ‘#selectionTags1’ ). value ;
const selectedVoice = $w ( ‘#selectionTags2’ ). value ;
const selectedAvailable = $w ( ‘#selectionTags3’ ). value ;

loadDataToRepeater ( selectedGenre , selectedVoice , selectedAvailable );
}

export function selectionTags3_change ( ) {
const selectedGenre = $w ( ‘#selectionTags1’ ). value ;
const selectedVoice = $w ( ‘#selectionTags2’ ). value ;
const selectedAvailable = $w ( ‘#selectionTags3’ ). value ;

loadDataToRepeater ( selectedGenre , selectedVoice , selectedAvailable );
}

function loadDataToRepeater ( selectedGenre , selectedVoice , selectedAvailable ) {
wixData . query ( collection )
. ascending ( “name” )
. hasAll ( ‘genres’ , selectedGenre )
. hasAll ( ‘voiceType’ , selectedVoice )
. contains ( “artistPage” , “yes” )
. hasAll ( “featuredYn” , selectedAvailable )
. find ()
. then ( results => {
$w ( ‘#repeater2’ ). data = results . items ;

  }); 

}

Any help would be appreciated!

async function loadMoreData() {

console.log(Data.length)                 

var old=$w(“#listRepeater”).data
var ne=[]
for (var i = $w(“#listRepeater”).data.length; i < $w(“#listRepeater”).data.length+1; i++) {
console.log(i)
ne.push(Data[i])
}
$w(“#listRepeater”).data=old.concat(ne)

}

Hi Umut,

May I please ask what ‘Data’ was referencing. Is it dataset or something else?

export function SearchButton_click(event) {

let searchValue = $w(‘#SearchBox’).value;

let searchWords = searchValue.split(’ ');
console.log(searchValue)

let query = wixData.query(‘…DATABASE_NAME…’)
.limit(50)

.descending(“…SEARCH COLUMN FIDEL NAME…”);

for (let i=0; i < searchWords.length; i++)
{
query = query.contains(‘overview’, searchWords[i])
}

query.find().then(res =>
{