Hi Yunus,
Query 1: It is possible to clear all file entries
from by using ClearAllAsync method:
We cannot clear the file entries in the saved
location when called the clearAllAsync method we can clear only the rendered
file list of the uploader component.
Query 2: Is there a way to clear only success
messages from the list, but not removing error messages and the files
still waiting in the upload queue?
We have achieved your requirement by using the JSIntrop.
Find the code example here:
[index.razor]
<div class="target">
<SfUploader @ref="uploadObj" ID="UploadFiles"
AutoUpload="false" DropArea=".target">
<UploaderAsyncSettings
SaveUrl="api/SampleData/Save" RemoveUrl="api/SampleData/Remove"></UploaderAsyncSettings>
<UploaderEvents
Success="OnSuccess" ></UploaderEvents>
</SfUploader>
</div>
@code
{
SfUploader uploadObj;
[Inject]
protected IJSRuntime JsRuntime { get; set; }
public string customHeader { get; set; } = "";
public void OnSuccess(Syncfusion.Blazor.Inputs.SuccessEventArgs
args)
{
JsRuntime.InvokeVoidAsync("onListClear", args);
}
}
|
[RemoveFileList.js]
window.onListClear = (id)
=> {
var fileListElement =
document.querySelectorAll(".e-upload-file-list");
for (var
count = 0; count <= fileListElement.length; count++) {
var
fileNameList =
fileListElement[count].getAttribute("data-file-name");
if
(fileNameList === id.file.name) {
fileListElement[count].remove();
}
}
}
|
Find the sample in the attachment:
Regards,
Sureshkumar P
Attachment:
Blazor_Upload_App_76302f97.zip