Hello, here I have a code for a search bar with loading gif. Everything seems to be working fine, I would just like for our employees to initially see the items from their last pay date only. I can’t set the limit number because each employee will have a different amount of entries, if any for that pay period.
I’m then looking to incorporate a dropdown for employees to only view THEIR pay dates, not the whole dataset’s dates.
The dataset is filtered by logged in user which I’ve had difficulties putting together so any advice is appreciated!!
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
$w.onReady( function () {
wixUsers.currentUser.getEmail()
.then((email) => {
let userEmail = email; //"user@email.com"
$w(“#dataset1”).setFilter(wixData.filter()
.eq(“loginEmail”, email))
})
})
let debounceTimer;
export function searchBar_keyPress(event) {
$w('#loadingGif').show();
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
let SearchValue = ($w(“#searchBar”).value);
wixUsers.currentUser.getEmail()
.then((email) => {
let userEmail = email; //"user@email.com"
$w(“#dataset1”).setFilter(wixData.filter().eq(“loginEmail”, email)
.contains(‘account’, SearchValue)
.or(wixData.filter().eq(“loginEmail”, email)
.contains(‘payType’, SearchValue)
.or(wixData.filter().eq(“loginEmail”, email)
.contains(‘payDate’,SearchValue))));
$w(‘#loadingGif’).hide();
}, 200);
});
}