A simple algorithm, in Corvid

Did you already have seen the example?
Already have tested and tried it out?

Is this example similar to what you want to create?

  1. Fill out (download-name) + (url) + (press “Add Download”).
  2. Do the same again, but do not fill out the URL.

Did you see the difference?

  1. Press on one of the DELETE-Buttons…

The DOWNLOAD-BUTTON itself is still not activated —> without function in this example.

Also a DATASET is used in this example ! ! !

import wixData from 'wix-data';

$w.onReady(function () {
    xxx()
    $w('#dataset8').onReady(()=>{
        $w('#button1').onClick(()=>{console-console.log("Saving-Process started");  
 let toSave
               toSave = {
 "title":    $w('#input1').value,
 "url":      $w('#input2').value,
            };
 
            wixData.save("downloads", toSave)
            .then( (results) => {
 let item = results; //see item below
                $w('#dataset8').refresh()
                console.log("Total-Count = " + $w('#dataset8').getTotalCount())
            } )
            .catch( (err) => {
 let errorMsg = err;
            } );
            xxx()
       })


       $w("#repeater1").onItemReady(async($item, itemData, index) => {
            $item('#button3').onClick(async(event) => {
                console.log(index);
                console.log(itemData);
 //    $item("#text1").text = "deleting in process"
                $item("#button2").hide()
 
 await $w('#dataset8').setCurrentItemIndex(index)

                $w('#dataset8').setFieldValues({
 "title":  "data deleted",
 "url":   ""
                } );
 
 //$w('#dataset8').setFieldValue("url", "")

                $w('#dataset8').save()
            })
        });  
    })
})

function xxx (parameter) {
    $w('#repeater1').onItemReady(($item, itemData, index) => {
 const thereIsNoUrl = !itemData.url
        console.log(index)
        console.log(itemData)
 if (thereIsNoUrl) {$item('#button2').collapse()}
    })
}

my used dataset = “dataset8”
my used repeater = “repeater1”

field: —> title = “download-name”
field: —> url = “Download-URL”