Clear method?

2 posts, 1 answers
  1. Dennis
    Dennis avatar
    24 posts
    Member since:
    Oct 2012

    Posted 07 Aug 2013 Link to this post

    I was very suprised to see so few methods in the documentation for the Kendo Upload, specially becouse I know it's been in the toolset a longer time. I basicly did my own UI for the upload. Most of the current buttons are hidden, I keep only the dropzone. The first problem I had is I couldnt just link methods to programaticly start an upload or open file choser dialog. I managed to get that functionality bi using their respective buttons click handlers.

    One method I'm strugling with is clearing the files list programaticly. So I have implemented an item edit window with a picture upload. On select I managed to extract a file preview for the image before its sent to the server. If you click the save button for the window the form gets saved and the new photo uplodaed. If you click cancel however and open the same edit window for a different item. The old picture stayed in the upload. I want to clear it. Is there a way to do that? I have the file list hidden.
  2. Answer
    Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 09 Aug 2013 Link to this post

    Hello Dennis,

    I am afraid that we do not have such API Method exposed that can help you programatically remove the file entry from the Upload widget.

    The only possible way I can think of is to use the internal method for this job.


    var up = $('#uploadName').data().kendoUpload;
    var allLiElementsToBeRemoved = up.wrapper.find('.k-file');
    up._removeFileEntry(allLiElementsToBeRemoved );

    Of course instead of removing all the files you can pick just these that you need.

    Once again keep in mind that using internal methods is not something that we recommend and it can potentially break the logic for future releases.

    I hope this helps.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top