Previously this was working. I am trying to get fullName displayed on page from a collection. I have created an after query which is active.
The script for this is as follows
// In file backend/data.js
export function MemberData_afterQuery(item, context) {
item.fullName = item.FirstName + " " + item.LastName;
return item;
}
export function PrivateMembersData_afterQuery(item, context) {
item.fullName = item.FirstName + " " + item.LastName;
return item;
}
//the script on the page in question is
$w.onReady( function () {
$w(“#dataset1”).onReady(() => {
populateCalculatedFields();
} );
$w(“#dataset1”).onCurrentIndexChanged( (index) => {
populateCalculatedFields();
} );
} );
function populateCalculatedFields() {
const currentItem = $w(“#dataset1”).getCurrentItem();
$w(“#textFullName”).text = currentItem.fullName;
}
// When the page loads the elements that have been connected using a dataset show, undefined, undefined
and the collection has a new entry in the row above where i would expect the fullName to be ‘collected’ from i.e. the last field of fullName which is correctly populated from the After Query setup.
There are no errors in the console when in preview mode
Can anyone suggest why this might be happening?
Thanks
Adam