Hello, everyone!
I’m not good at English. So maybe my sentences are little weird.
I’m trying to make a image upload system but it has some problems.
When upload button’s value changes, upload to media manager, make file an Array, and insert to repeater.
This worked well, but it had one problem.
First item only show default image and text.
I checked item’s Data but it was OK.
Here’s the code
$w.onReady( function () {
RepeaterSetItem();
$w( “#repeater1” ).data = ;
});
function RepeaterSetItem() {
$w( “#repeater1” ).onItemReady(($item, itemData, index) => {
$item( “#PreveiwImage” ).src = itemData.img;
$item( “#FileName” ).text = itemData.filename;
})
});
}
export function uploadButton_change(event) {
console.log( “Image Insert” );
$w( “#uploadButton” ).startUpload()
.then((uploadedFile) => {
container = [{
“_id” : “item” + itemindex,
“img” : uploadedFile.url,
“filename” : $w( “#uploadButton” ).value[ 0 ].name
}];
itemindex++;
let tempData = $w( “#repeater1” ).data;
$w( “#repeater1” ).data = tempData.concat(container);
})
}
I tried using async and await , but I couldn’t solve it.
I hope you guys can help me.
Thanks