This is a migrated thread and some comments may be shown as answers.

How to customise delete operation?

3 Answers 251 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Tayger
Top achievements
Rank 1
Iron
Tayger asked on 23 Apr 2017, 06:36 PM

Hello 

I checked the remove functions of the Upload Widget. As far as I understand: Any remove functionality reacts only on files "inside" the Upload widget. The widget itself is not persistent: You can upload files by the widget to get files into that list. You then can delete/remove them right away. After reload the page this file list is empty. The usual business case I know is: Customer do upload files on a day and want to delete it any other day or just later. I have such a case and create a unique ID for each uploaded file. I wonder if and how it is possible to use the Upload widget by sending this ID and triggering the removeURL handler. I've found some very old entries, one with trigger the remove event by "$(".k-delete").parent().click();" but nothing happens doing that. 

The most simple way would be to add a file to be deleted on that file list and then call the removeURL handler. 

Is there an easy way to do that or is it better to use a separate AJAX call?

Regards

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 24 Apr 2017, 07:22 AM
Hello,

If async mode is enabled there is a way to programmatically pre-populate the Upload's file list. See the files configuration option for more details and an example.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tayger
Top achievements
Rank 1
Iron
answered on 24 Apr 2017, 07:54 AM

Hi Ivan

Thank you for the link. Ummm, based on the documentation the Upload Widget would then upload the files in the list (start the uploadURL handler). In my case I would like to to call the removeURL handler. How do I do that or how does the Upload handler know it has to call the remove handler?

0
Ivan Danchev
Telerik team
answered on 26 Apr 2017, 08:02 AM
Hi,

The saveUrl handler is not called when using the files option. The files are just rendered in the list and will look as uploaded, but are not actually uploaded. As for calling the removeUrl handler, clicking on the x button will do that. Another way to trigger the remove handler programmatically is by calling the removeFileByUid method.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Upload
Asked by
Tayger
Top achievements
Rank 1
Iron
Answers by
Ivan Danchev
Telerik team
Tayger
Top achievements
Rank 1
Iron
Share this question
or