Sorry I was late but here is the problem.
We don’t have any problem with backend or frontend code. In fact, we don’t have any problem. Text elements inside the page are connected to dataset but but we are doing with backend function is not related to dataset any we are not changing anything with dataset data. Because of that you were still seeing first item from the database.
What you need to do is you need to pass the current member data to text elements using code not using dataset feature.
First Way (Using $w.Text HTML )
You can pass HTML code to text using .html property of $w.Text elements. And this is the one of the ways you can achieve what you want. In your page you have at least two Text for title and for the data but actually you don’t need that much element when you use HTML.
Here is the code with HTML:
import { getMemberItem } from 'backend/memberFilter.jsw';
$w.onReady(async function () {
const membershipData = await getMemberItem();
//One Text Element using HTML -------------
$w('#matchFees').html = `<b><p style="font-size: 18px">Match Fees:</b> £${membershipData.matchFees}</p>`;
$w('#clubFees').html = `<b><p style="font-size: 18px">Club Fees:</b> £${membershipData.clubFees}</p>`;
$w('#membershipType').html = `<b><p style="font-size: 18px">Membership Type:</b> ${membershipData.membershipType}</p>`;
});
Second Way ($w.Text.text)
When we use text property, we can’t make title bold so because of that you will need to use two elements. One for title one for data.
Here is the code with text:
import { getMemberItem } from 'backend/memberFilter.jsw';
$w.onReady(async function () {
const membershipData = await getMemberItem();
//Two Text Element Using Text -------------
$w('#matchFees').text = `£${membershipData.matchFees}`;
$w('#clubFees').text = `£${membershipData.clubFees}`;
$w('#membershipType').text = `${membershipData.membershipType}`;
});
Third Way (Using Dataset APIs)
If you want to keep using dataset and connect data using data connection. Shortly if you don’t want to write code to pass data to elements here is your way. You will use your current setup and you will only need two lines of code.
Here is the code with Dataset Filter API:
//Velo API Imports
import wixData from 'wix-data';
import { currentMember } from 'wix-members';
$w.onReady(async function () {
// Three text element using dataset -------------
const { _id } = await currentMember.getMember();
$w('#dataset1').setFilter(wixData.filter().eq("member", _id));
});
*Note: If you use backend function and connect data using text or html property of Text elements. You should do the same for any extra element that you will add to the page.
Here is the video: Filtering with Current User | Claap