I got this code template from https://www.wix.com/corvid/new-reference/wix-dataset/dynamicdataset/getcurrentitem
$w.onReady( () => {
$w("#myDataset").onReady( () => {
let itemObj = $w("#myDataset").getCurrentItem();
} );
} );
Hi! I am trying to use the code above to retrieve data from my dataset but the program is giving me an error saying #myDataset is not valid.
What is supposed to go into the #?
I also heard that I'm supposed to bind/connect #myDataset to my database collection? How would I do that?
Thanks!
Hello Melia,
what you have is just a example-code.
$w.onReady( () => { $w("#myDataset").onReady( () => { let itemObj = $w("#myDataset").getCurrentItem(); } ); } );
You have to modify it and set it right. Like you sad, you have to bind/connect it.
Look which ID has your Dataset. I assume it will be the ID ---> "dataset1" if it is the first and only one on your page.
So if it is like i assume, then your code should be the following...
$w.onReady( () => { $w("#dataset1").onReady( () => { let itemObj = $w("#dataset1").getCurrentItem(); } ); } );