Still unclear, if your code is located on a dynamic , or a non-dynamic page ?
What do we know already?
- DATASET --------> “prodottiDataset”
- DATABASE ------> “Prodotti”
- REFERENCE1 → “Finiture”
- REFERENCE2 → “galleriaProdotto”
- STRIP1 ------------> “finiture”
- STRIP2 ------------> “stripDettagli”
Further, when working with datasets, your datasets should always first be ready, before working with them.
$w.onReady(function() {
$w(DATASET).onReady(()=>{
// your code here....
});
});
If you are using a —> DYNAMIC page, where you only can show an item at once…
import wixData from 'wix-data';
import wixLocation from 'wix-location';
const DATASET = '#prodottiDataset'
const DATABASE = 'Prodotti'
const REFERENCE1 = 'Finiture'
const REFERENCE2 = 'galleriaProdotto'
const STRIP1 = '#finiture'
const STRIP2 = '#stripDettagli'
$w.onReady(async function () {
$w(DATASET).onReady(()=>{
//$w(DATASET).setFilter(wixData.filter().eq('storeProducts', product._id));
let finiture = $w(DATASET).getCurrentItem().finiture;
let gallery = $w(DATASET).getCurrentItem().galleriaProdotto;
if (finiture) {$w(STRIP1).expand();} else {$w(STRIP1).collapse();}
if (gallery) {$w(STRIP2).expand();} else {$w(STRIP2).collapse();}
});
});
If you entered your dynamic page and starts to switch items, your 2x STRIPS will appear or disappear, related to their values connected to the related DATASET.