I need a code so that an image that expands after a button click remains active after that click even if the page loads. The database is per user.
I tried to use the code below but didn’t answer:
import wixData from ‘wix-data’ ;
$w.onReady( function () {
let toSave{
image: $w( ‘#dataset1’ ).getCurrentItem().image,
};
wixData.save( “dataset1” , toSave)
});
export function aulaNaoConcluida_click(event) {
if ( $w( “#repeater1” ).collapsed ) {
$w( “#repeater1” ).expand();
}
else {
$w( “#repeater1” ).collapse();
}
}
I tried to use this too but it didn’t work
$w.onReady( () => {
$w(“#dataset1”).onReady( () => {
$w(“#dataset1”).setFieldValues( {
“image”: “image1”,
Hello Jr,
i think, i can show you a goog example for your issue, which could eventually solve your Problem.
Take a look here…
https://russian-dima.wixsite.com/meinewebsite/switch-safe-function
I think this is exactly what you will need to achieve your aim.
@russian-dima thank you very much! It will help me a lot.
I hope so 
And do not forget —> like it, if you really like it 
@russian-dima
Wind is saved by user or in cache (local)?
Did you already read all the stuff? Also the Forum-Post, related to this example?
In this example you use a database to save your button-state.
@russian-dima Indeed. It is true. Now that I’ve seen the details. I can say that I love you so much for your tutorial hahahahahahaha
You will find more soon 
If one day the URL is broken, you will probably find some information in my profile or just follow me and you will always be up to date! 
@russian-dima So, one more question, I promise! In your database you created a Boolean column to activate the button, right?
Good question, i have to complete it in my example… wait a minute…
@russian-dima Congratulations on the work of your post. It is incredibly perfect and well explained.
Thanks, nice to hear 
Here the database-structure for this example (i will update the example later)
I hope now you understand it much better.
I think you could also use cache (local)
https://www.wix.com/corvid/reference/wix-storage.html
But this one is the SAFE one on my opinion
@russian-dima Thank you!Don’t stop doing tutorials.You don’t know how good you did me.
Then I probably earned an “Best-Answer” xD 
@russian-dima I suppose button1 is the save.What would be the button too much?Is button3 to close the container box of your tutorial?

Ok, i will complete this in my tutorial, just wait for UPDATE.
And YES —> “button3” is the save-button, i will update the names of buttons, for better understanding.
@russian-dima Do the entire procedure after the changes you made.But, a choice made on the button is not recording (saving) after loading a page.Realize that in your tutorial you are also no longer responding to the button.Before it was ok, because I checked if it remains active after updating a page.
@russian-dima If you have corrected your code and your tutorial page is saving the choice of the “if false” or “if true” button, that is, deactivated or activated.Did you change anything in the code?
Sorry for the little trouble, yes i am changing the code-structure. Update will coming-up soon, please be patient 
I have saw some weaknesses in my code, so i have to reload it.