Is it possible to programmatically perform actions on the uploader, such as to remove files, rather than having to click on the remove button on each uploaded file?
---
ADMIN EDIT
Might be related to the ability to have initial files shown in the list: https://feedback.telerik.com/blazor/1485660-initial-files-in-blazor-upload.
At the moment, you could try using JS Interop to loop over the list, determine which file you want to remove and .click() its remove button. Here is a basic example of getting the buttons to click the second one. You could traverse the DOM to get the file name, or you could keep a collection of the files to use indexes in a fashion similar to this example.
@inject IJSRuntime _js
@* move this script to a correct location it's here as ahack to make the snippet shorter and easy to copy *@
<script suppress-error="BL9992">
function removeSecondFile(){
var deleteButtons = document.querySelectorAll("li.k-file button span.k-delete");
if(deleteButtons && deleteButtons.length > 1){
deleteButtons[1].click();
}
}
</script>
<TelerikUpload AutoUpload="false" SaveUrl="my-endpoint"></TelerikUpload>
<TelerikButton OnClick="@RemoveSecondFile">Remove second file</TelerikButton>
@code{
async Task RemoveSecondFile()
{
await _js.InvokeVoidAsync("removeSecondFile");
}
}
---