I have a repeater pulling items from a database. For each item that displays there is an Update button that sets session variables and edits the item on a user input form. This had been working last time I used it. Has something changed?
Here is the code:
Source Repeater code:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
import {local, session} from ‘wix-storage’;
import wixWindow from ‘wix-window’;
let DashNo = session.getItem(“CarId”);
console.log("Session Dash " + DashNo);
let eDate;
$w.onReady( function () {
let CarId = session.getItem(“CarId”,CarId);
$w(‘#headerDash’).text = CarId;
$w("#dataset1").setFilter(wixData.filter()
.eq("dash_no", CarId)
)
.then(() => {
$w("#repeater1").forEachItem( ($w, itemData, index) => {
let repeatedElement = $w(“#iDate”);
let D_String = new Date(itemData.entry_date)
let D_Locale = D_String.toLocaleDateString(“en-US”)
repeatedElement.text = D_Locale
} )
.then(() => {
$w(“#repeater1”).show();
})
})
});
export function updateButton_click(event, $w) {
let $item = $w.at(event.context);
let CarId = $item(“#headerDash”).text;
session.setItem(“Edit#Sel”, “Edit”);
session.setItem(“CarId”,CarId);
session.setItem(“eDate”,eDate);
}
export function deleteButton_click(event) {
//Add your code for this event here:
}
export function refreshButton_click(event) {
$w(“#dataset1”).refresh()
.then( () => {
console.log(“Done refreshing the dataset”);
} );
Input / Update Form Code:
import {session} from ‘wix-storage’;
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
$w.onReady( function () {
let formType = session.getItem(“Edit#Sel”);
let CarId = session.getItem(“Car-Id”);
let eDate= session.getItem(“eDate”);
console.log(CarId);
console.log(eDate);
if (formType === “Edit”){
$w(“#dataset1”).setFilter(wixData.filter()
.eq(“Dash_no”, CarId)
.eq(“Entry_Date”, eDate)
)
} else {
$w(“#saveButton”).label = “Submit”;
}
});
What has changed in the Wix API. This was working fine six months ago or longer???