This however only happens when i add this:
When i delete this code, the dataset refresh, runs great without any problems.
This however only happens when i add this:
When i delete this code, the dataset refresh, runs great without any problems.
import wixData from 'wix-data';
$w.onReady(() => {
$w("#dynamicDataset").refresh();
let itemObj = $w("#dynamicDataset").getCurrentItem();
$w("#balance").text = itemObj.money.toString();
var balance;
setTimeout(function () {
balance = parseFloat($w('#balance').text);
if (balance >= 1.20) {
$w('#b1').enable();
}
if (balance >= 0.60) {
$w('#b2').enable();
}
if (balance >= 1.70) {
$w('#b3').enable();
}
if (balance >= 0.90) {
$w('#b4').enable();
}
});
}, 500);
function topup() {
let itemObj = $w("#dynamicDataset").getCurrentItem();
console.log("Inside ToPup");
var balance = itemObj.money;
var input = parseFloat($w('#topup').value);
if (input >= 1) {
$w("#balance").text = itemObj.money.toString();
var final = balance + input;
let toUpdate = {
"_id": itemObj._id,
"firstname": itemObj.firstname,
"lastname": itemObj.lastname,
"photo": itemObj.photo,
"energopaso": itemObj.energopaso,
"liksipaso": itemObj.liksipaso,
"energopaso2": itemObj.energopaso2,
"liksipaso2": itemObj.liksipaso2,
"energopaso3": itemObj.energopaso3,
"liksipaso3": itemObj.liksipaso3,
"money": parseFloat(final)
};
console.log("ToUpdate");
wixData.update("passengers", toUpdate);
$w("#balance").text = itemObj.money.toString();
$w("#text20").text = "Επιτυχής Πίστωση " + input + "€.";
$w('#text20').show("FadeIn");
$w("#balance").text = itemObj.money.toString();
if (itemObj.money >= 1.20) {
$w('#b1').enable();
}
if (itemObj.money >= 0.60) {
$w('#b2').enable();
}
if (itemObj.money >= 1.70) {
$w('#b3').enable();
}
if (itemObj.money >= 0.90) {
$w('#b4').enable();
}
} else {
$w("#text20").text = "Ελάχιστο ποσό 1€.";
$w('#text20').show("FadeIn");
}
}
export function button1_click() {
topup();
}
export function b1_click() {
$w('#b1').disable();
$w('#b2').disable();
$w('#b3').disable();
$w('#b4').disable();
$w('#button3').show("FadeIn");
$w('#text21').show("FadeIn");
}
export function button3_click() {
let itemObj = $w("#dynamicDataset").getCurrentItem();
if (itemObj.money >= 1.20) {
$w('#b1').enable();
}
if (itemObj.money >= 0.60) {
$w('#b2').enable();
}
if (itemObj.money >= 1.70) {
$w('#b3').enable();
}
if (itemObj.money >= 0.90) {
$w('#b4').enable();
}
$w('#button3').hide();
$w('#text21').hide();
}
I know it is a little late but did you manage to find the problem?
I get the same error at line 17
// API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center
import wixData from ‘wix-data’ ;
$w.onReady(() => {
let item = $w( “#dynamicDataset” ).getCurrentItem;
// substitute your field name storing the tags
let chosenValues = item.klimatisierung;
let newOptions = buildOptions(chosenValues);
$w( “#checkboxGroup3” ).options = newOptions;
// if you want them all checked?
let indices = buildSelectedIndices(chosenValues);
$w( “#checkboxGroup3” ).selectedIndices = indices;
});
function buildOptions(chosenValues) {
return chosenValues.map((curr) => {
return { label: curr.toString(), value: curr };
});
}
function buildSelectedIndices(chosenValues) {
let selIndices = ;
for ( var i = 0 ; i < chosenValues.length; i++) {
selIndices.push(i);
}
return selIndices;
}