Reset upload.

9 posts, 0 answers
  1. Juan
    Juan avatar
    3 posts
    Member since:
    Nov 2011

    Posted 28 Nov 2011 Link to this post

    Is there any way to reset the upload form without the control firing the remove event on previously uploaded files?
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 01 Dec 2011 Link to this post

    Hello Juan,

    The only way to do that at the moment is to remove the elements from the DOM directly:

    $("#attachments").parents(".t-upload").find(".t-upload-files").remove()

    The current behavior is very questionable - the reset should not send any information to the server. We'll change it to simply clean the file list. Removing all files can be done via a removeAll() method, for example.

    Thank you for bringing this question up. As a token of gratitude for your involvement your Telerik points have been updated.
    Regards,
    Tsvetomir Tsonev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Vishwa
    Vishwa avatar
    4 posts
    Member since:
    Dec 2011

    Posted 21 Jan 2012 Link to this post

    I have (temporarily) called : $(".k-upload-files").remove(); to reset the list of the selected files.  Work for well for me.
  5. Daniel
    Daniel avatar
    17 posts
    Member since:
    Jan 2014

    Posted 17 Apr 2014 Link to this post

    I need this behavior too! This should be build into upload widget!

    Regards,
    Daniel

    BTW: The workaround mentioned by T.Tsonev works for me (but this should not be the right way to do it)
  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 17 Apr 2014 Link to this post

    Hi Daniel,

    Thank you for the suggestion. I'll pass it to the development team for discussion if this functionality should be added out of the box. Meanwhile you could also post it as a suggestion in our Feedback portal or vote for it if it's already there.


    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Mac
    Mac avatar
    36 posts
    Member since:
    Nov 2006

    Posted 13 May 2014 Link to this post

    +1 for fixing this.

  8. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 13 May 2014 Link to this post

    Hello Scott,


    As stated in the previous post, you could post this as a suggestion in our Feedback portal. I checked and it seems that this has not been posted yet.

    In the mean time, you could use the workaround from the previous post.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  9. Brandon Peterson
    Brandon Peterson avatar
    47 posts
    Member since:
    May 2007

    Posted 04 Jun 2014 Link to this post

    Here is a function that I added in my general UI class to do this. Works with v2014.1.318

    uploadReset: function(id) {
        if (id) {
            //if an id is passed as a param, only reset the element's child upload controls (in case many upload widgets exist)
            $("#" + id + " .k-upload-files").remove();
            $("#" + id + " .k-upload-status").remove();
            $("#" + id + " .k-upload.k-header").addClass("k-upload-empty");
            $("#" + id + " .k-upload-button").removeClass("k-state-focused");
        } else {
            //reset all the upload things!
            $(".k-upload-files").remove();
            $(".k-upload-status").remove();
            $(".k-upload.k-header").addClass("k-upload-empty");
            $(".k-upload-button").removeClass("k-state-focused");
        }
    }
  10. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 05 Jun 2014 Link to this post

    Hi Brandon,


    Thank you for sharing the sample code.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready