The following is the code
import {session} from ‘wix-storage’;
import wixData from “wix-data”;
$w.onReady( function () {
//TODO: write your page related code here…
let EventsRecID=session.getItem(“EventsRecID”);
session.setItem(“EventsRecID”,EventsRecID);
console.log(“Querying Events with EventsRecID=”+EventsRecID);
wixData.query(“Events”)
.eq (“title”,EventsRecID)
.limit(1)
.find()
.then( (results) => {
let totalCount = results.items.length;
if (totalCount>0) {
console.log(“results.totalCount=”+results.totalCount);
console.log(“results.currentPage=”+results.currentPage);
let EventsRecIdx = results.currentPage;
console.log(“setting EventsDataset item index to “+EventsRecIdx);
$w(”#EventsDataset”).setCurrentItemIndex(EventsRecIdx);
}
})
. catch ( () => {
});
});
and the console.log output is shown below:
---------- CurPast, found Events record ---------- CurrentPastEvents Line 33
Edit, was clicked, EventsRecID=05fcd395-020f-43e9-90fb-cec177d91165
CurrentPastEvents Line 37
Loading the code for the site. To debug this code, open masterPage.js in Developer Tools.
Loading the code for the EventDetailPage page. To debug this code, open xsyse.js in Developer Tools.
Querying Events with EventsRecID=05fcd395-020f-43e9-90fb-cec177d91165
EventDetailPage Line 9
results.totalCount=1 EventDetailPage Line 17
results.currentPage=0 EventDetailPage Line 18
setting EventsDataset item index to 0