Repeater Issues (Show more buttons and sorting)

Here is my site: laurenvitale.wixsite. com/website-3/meet-the-team

So I can get the instructors to sort correctly and have the “Show More” not work (below) or sort randomly and have the “Show More” button work if I change $w.onReady to $w.onChange

Really new at this any help would be awesome!


Here is the code. Had trouble putting it as a post.

import wixData from 'wix-data';

const databaseField = 'nfpIn';

$w.onReady(function() {console.log("Page ready!");
    addItemstoRepeater();

    $w('#repeater1').onItemReady(($item, itemData, index)=>{
        $w('#button4').onClick(()=>{console.log("Button4 clicked!");
            $item('#text88, #text62').expand(); 
            $item('#button4, #text61').hide();
            $item('#button6').show();
        });

        $w('#button6').onClick(()=>{console.log("Button6 clicked!");
            $item('#text88, #text62').collapse();
            $item('#button4, #text61').show();
            $item('#button6').hide();
        });
    }); 
    
    $w('#dropdown1').onChange(()=>{
        let searchBrand = $w("#dropdown1").value; console.log(searchBrand);
        if (searchBrand === "All") {$w("#dataset1").setFilter(wixData.filter());}
        else {$w("#dataset1").setFilter(wixData.filter().contains("State", searchBrand));}
    });

    $w('#selectionTags1').onChange((event) => {
        const selectedTag = $w('#selectionTags1').value;
        addItemstoRepeater(selectedTag);
    });

    $w('#search').onChange(()=>{
        let searchBrand = $w("#search").value;
        if (searchBrand === "All") {$w("#dataset1").setFilter(wixData.filter());}
        else {$w("#dataset1").setFilter(wixData.filter().contains("state", searchBrand));}
    });
});


function addItemstoRepeater(selectedOption = []) {console.log("Add items to repeater running...");
    let dataQuery = wixData.query('Instructors');
    if (selectedOption.length > 0) {
    dataQuery = dataQuery.hasSome(databaseField, selectedOption);
    }

    dataQuery
    .find()
    .then(results => {
        const filtereditemsReady = results.items;
        $w('#repeater1').data = filtereditemsReady;
    }).catch((err)=>{console.log("Something gone wrong! ERROR: " + err);});
}