Hi all,
I’m just starting to get familiar with Wix code, so I’m sure there’s an easy solution to what I’m doing wrong. But, I’ve stared at the reference pages long enough that they’re starting to laugh at me, so I figured I’d reach out.
I have two primary issues:
First, I am trying to dynamically resize the repeater container for each item based on whether or not it’s primary data field is filled or not. Essentially, each container will have a date attached to it. If the date is in the future, I would like it to only display the date and the container should be sized proportionately. If the date is in the past, the container should display the date and the connected data, and will be larger as a result. The expand() function seems to be working, but the size of the container doesn’t change either way.
Second, the data will consist of one or more links to (another) dynamic page on the site. The code below is displaying the web address but is not clickable. Is there an easy solution to this?
I’m struggling through, but feeling like I’m missing the basis for a lot of the syntax in Wix code. “==” vs. “===”, for example. I’ve looked through the Hello World example and a host of others, but if anyone can recommend a comprehensive guide to the basics, I’d be deeply grateful.
Best,
Justin
import wixData from "wix-data";
$w.onReady(() => { //page loads
$w("#dynamicDataset").onReady(() => { //dataset loads
let Client = $w("#dynamicDataset").getCurrentItem(); //page subject
$w('#DogName').text = Client.dogsNameId + "'s"; //page header
$w("#sessions").onReady(() => {
$w("#sessionRepeater").forEachItem(($w, itemData, index) => { //set repeater item values
console.log(String(index)); // position in loop
SetSession(itemData, $w)
if (itemData.completed) { //check boolean for whether or not to display
console.log("in test"); //confirm check passed
$w("#group7").expand(); //expand group holding primary repeater value
$w("#ratingsInput1").expand();
$w('#topics').html = itemData.reviewTopic1; //set primary repeater value
$w('#topics').text = itemData.reviewTopic1; //set text for primary repeater value
}
})
});
});
});
function SetSession(itemData, $w) {
console.log("the session in this part though is " + String(itemData.session));
$w('#session').text = "Session: " + String(itemData.session) + " of " + String(itemData.currentPackage); //set repeater heading
$w('#date').text = String(itemData.sessionDate.toLocaleDateString()); //set repeater heading
}