I have a list of my collection, and I had it working so that you pick a person, it opens the record. You can update the information and click the update button and it updates the record. It was working fine, and I updated 281 out of 415 records. Haven't worked on for about 2 weeks. Today when I started, I am not sure exactly what it is doing. but the changes, even though they show up on the page, do not stick. Meaning when I go back to the list to the same record, the changes are not made.
Promise I made no changes to the code and it has just quit working.
here is the url png68.online.
I am going to unprotect the page so that someone can go check it out.
Tomer, you are so my favorite. Added the dataset on ready and not only did it fix the problem I previousy had with updates not occuring, but in addition the logic that I had tried to fix for weeks, now works as well.
Thanks again.
Here's the code, similar to how $w.onReady works:
$w.onReady(function () { const userDataset = $w('#dynamicDataset') ;// Dataset of the page userDataset.onReady(() => { wixUsers.currentUser.getEmail() .then( (email) => { // check if email is the same as in the dataset }); }); });
Tomer, Thanks so much. I read the information about dataset onready, and see an example, but not sure how/where to add it to my code.
I do have an $w(on ready) function function within which the constr of the dataset occurs.
Would it be possible for you to point me where to add the onready for the dataset?
Hi Sandy,
We didn't make any changes to the API that I'm aware of.
One thing I notice from that piece of code is that it doesn't wait for the dataset to be ready.
This could cause something to work or not work depending on unpredictable things like slow network.
If you had any errors in the developer console, you can post them here so we could try and figure out what happened.
OK, I have my page working . I just removed this code.
This code was working two weeks ago, but whatever, removing it has me able to work.
I'll add it back after I get the bulk of my updates done.
Wix team, I was wondering if there is any possibility that you did something when you changed the update API on about the 17th?
Just a thought.
=======================================================
// Check if logged in user matches email address in page
import wixUsers from 'wix-users';
//import wixData from 'wix-data';
//let userRole = wixUsers.currentUser.role;
$w.onReady(function () {
const userDataset = $w('#dynamicDataset') ;// Dataset of the page
//.................................
wixUsers.currentUser.getEmail()
.then( (email) => {
if (email !== userDataset.getCurrentItem().emailAddress) {
$w("#update").disable();
} else {
$w("#update").enable();
}
});
});
I had something similar today: changed a date in Database Grid, clicked on the next row afterwards, code did not work. Went back to grid, date was still the old one. Did it again and then the change was committed. Thought I had made an error. But then I changed date back to its original value, clicked on row below to save it, code did not run as expected. Went back again to grid, date was again not saved, did it again, then it was committed. Don´t know if this and Sandy´s are related, but I do know that this started recently.
Sorry, I made it password protected, password is tester
Here is URL to example page.
https://www.png68.online/Classmates/jrogers