I have make my own ToDo List. The problem what i have is, that when i transfer from one to other collection (example: 3 -> 4) they move only the first repeater box (example: 1 -> 4) .
But i want when i click transfer (example: 2 -> 4).
Here the picture:
Here the code:
export function button3712_click(event) {
let toInsert = $w("#dataset6").getCurrentItem(); //gets the current item
wixData.insert("T1", toInsert) //inserts the item
.then( (results) => {
console.log("done adding item")
} )
.catch( (err) => {
let errorMsg = err;
} );
}
Hope any can help me with new code or edit this code.
Here is the code considering you have a dataset connected to it
export function button3712_click(event) { let item = $w("#dataset6").getCurrentItem(); //gets the current item wixData.remove("collectionId", item) .then((res) => { console.log("Done removing item") $w('#dataset6').refresh() wixData.insert("T1", res) //inserts the item .then((results) => { console.log("done adding item") $w('#dataset').refresh() //Refresh the dataset if needed }) .catch((err) => { let errorMsg = err; }) }) .catch((err) => { let errorMsg = err; }) }
This is a great app!
You need to remove the item from the previous collection as well. You can use wixData.remove("collectionId", "ItemId").
If you are using a dataset, you can then use wixData.refresh() so that the changes are reflected. And if you are using code to set the repeater, then you can just change the repeater.data array
I hope this was helpful :)