I’ve been developing some dynamic pages for a few days now quite happily. Then today for no apparent reason I’ve suddenly started getting an error in preview.
TypeError: Cannot read properties of undefined (reading 'config')
TypeError: $w(...).getCurrentItem is not a function
I’ve no idea where it’s coming from and I don’t refer to a variable called config. Please can someone offer me a suggest as to what’s causing it.
I’ve rolled back to a previous version but it’s still doing it!
Help!!!
Hi Doug,
I can’t help since we don’t see any code.
What you can do is:
- Post your page code
- tell us wat line gives the error. (Its normally displayed next to the error line)
- check for updates from wix.
And see if there is anything you use that has been updated.
Als, you tell us you get the error in preview.
Does it also displays in the console on the live website?
If we can’t figure it out you can contact wix support, or if you aren’t afraid me looking at your code, you could make a copy of your website and invite me as a contributor so i can take a look.
NOTE: I’m not velo expert, or in any way connected to the wix team, i’m just someone that likes to help where i can
Kind regards,
Kristof
Hi Kristof,
it’s good of you to reply. It’s a completely empty dynamic page! The code is quite simple
$w.onReady(function () {
$w("#eventsDynamicDataset").onReady(() => {
populateCalculatedFields();
} );
$w("#eventsDynamicDataset").onCurrentIndexChanged( (index) => {
populateCalculatedFields();
} );
} );
function populateCalculatedFields() {
let currentItem = $w("#eventsDynamicDataset").getCurrentItem();
$w("#dateLocation").text = currentItem.scheduleFormatted+' | '+currentItem.locationName;
}
The console log doesn’t give a line number. All very odd
Hi Doug,
Can you check something.
check the dataset read/write permission.
Calling onCurrentIndexChanged() on a write-only dataset causes an error.
Next what you should try is :
add the dataset.onReady() inside the populateCalculatedFields function.
Let me know how it works out.
This is bizarre! Just as quickly as the error started it’s stopped again! Sometimes these little ‘quirks’ can be amusing but I’m spending a lot of time trying to figure out where they’ve come from and why. Not good, not good at all